How to convert dots to commas decimal notations using excel formula - regex

Let's say the user enters 1.234.567,89 or 1,234,567.89 or 1 234 567,89 in any excel cell one by one and in all the above cases the user should get 1234567,89 in the output cell.

Excel
Try TEXT() with a custom format:
=TEXT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,",",""),".","")," ",""),"[>=100]#\,#0;#")
Google Spreadsheets
Try using REGEXREPLACE():
=TEXT(REGEXREPLACE(TEXT(A1,"#"),"[ ,.]",""),"[>=100]#\,#0;#")

=ARRAYFORMULA(IF(LEN(A1:A),
IFERROR(REGEXREPLACE(A1:A, "\s|\.", ),
REGEXREPLACE(""&A1:A, "\s|\.", ",")), ))

Related

Importhtml Query Extract Between String

I'm trying to find a formula that fits two tables
=QUERY(IMPORTHTML(A1,"table", 16), "Select Col4")
output is
Page 1/10Page 2/10Page 3/10Page 4/10Page 5/10Page 6/10Page 7/10Page 8/10Page
9/10Page 10/10
Another:
=QUERY(IMPORTHTML(A2,"table", 16), "Select Col4")
output is
Page 1/3Page 2/3Page 3/3
I want to extract the digits between "space" and "/" Is there a way to do this in this formula itself?
I then tried this
=transpose(SPLIT(REGEXREPLACE(A2,"Page|/10","~"),"~",0,1))
This also doesn't work since I have to manually change /10 to /3 in the second formula
Is there any way to achieve this for both data?
The sheet is here
try:
=ARRAYFORMULA(IF(ROW(A1:B)<=(1*{
REGEXEXTRACT(IMPORTXML(A1, "//option[#value='21']"), "\d+$"),
REGEXEXTRACT(IMPORTXML(B1, "//option[#value='21']"), "\d+$")}),
ROW(A1:B), ))

Seperate Number from Text

I'm working in google sheets and I need to separate
876,87.689APPLES into 876,87.689 and APPLES, in two different fields.
With the command
=value(regextract(field,"-*\d*\.?\d+")),
I get 876,87,689
It ignores the fact that its a decimal number.
I don't know why it doesn't work.
try:
={REGEXEXTRACT(A1, "[0-9,\.]+"), REGEXREPLACE(A1, "[0-9,\. ]+", )}

Is there a formula to count how many times multiplication is used in cell?

I have in Google Sheets (or Excel) a cell with a content =2*34+3*39
I need to sum up all the numbers used before the multiplication, in this example it would be 5 (2+3).
Is there any formula in Google Sheets or Excel to do this work?
There are hundreds of different formulas, but I can't find any suitable.
This will take an assumption, that the formula only use + for each mulification:
=sum(query(arrayformula(split(transpose(split(REGEXREPLACE(FORMULATEXT(A38), "=", ""), "+")), "*")), "select Col1"))
And this with an assumption, that the formula use + and each has multification:
=sum(arrayformula(value(regexextract(transpose(split(REGEXREPLACE(FORMULATEXT(A38), "=", ""), "+")), "^(.*)[*]"))))
sure:
=LEN(REGEXREPLACE(FORMULATEXT(A1); "[^*]"; ))
=ARRAYFORMULA(SUM(1*IFERROR(REGEXEXTRACT(SPLIT(REGEXREPLACE(
FORMULATEXT(A1); "(\*)"; "$1♥"); "♥"); "(\d+)\*"); 0)))

how to extract number sets in parentheses from Google sheet

How to extract and split this set of numbers (314.81+10.00)+0.00 to each column
expected result:
Try in W1
=ARRAYFORMULA(value(split(regexreplace(V1, "\(|\)",), "+")))
and see if that works?
like this:
=SPLIT(REGEXREPLACE(A1, "\(|\)", ), "+")
and ArrayFormula would be:
=ARRAYFORMULA(IFERROR(SPLIT(REGEXREPLACE(A1:A, "\(|\)", ), "+")))
Well, in for a penny, in for a pound.
=split(substitute(substitute(A2,"(",""),")",""),"+",1,1)
You need to format the fields as "0.00".

bigquery standard sql = extracting data from strings

I am looking to extract parts of a string that follow specified letters, for example from the below string:
wc:275,nwc:267,c1.3:2,c12.1:25,c12.10:39,c12.12:21,c12.13:4
I am looking to extract 275 (for wc), 2 (for c1.3) and 25 (for c12.1).
I have tried the following but the fields anew, ridanxietycnt and wordcount just show "NULL".
SELECT substr(CAST((DATE) AS STRING),0,8) as daydate,
count(1) as count,
avg(CAST(REGEXP_REPLACE(V2Tone, r',.*', "")AS FLOAT64)) tone,
avg(CAST(REGEXP_EXTRACT(GCAM, r'c1.3:([-d.]+)')AS FLOAT64)) anew,
sum(CAST(REGEXP_EXTRACT(GCAM, r'c12.1:([-d.]+)')AS FLOAT64)) ridanxietycnt,
sum(CAST(REGEXP_EXTRACT(GCAM, r'wc:(d+)')AS FLOAT64)) wordcount
FROM `gdelt-bq.gdeltv2.gkg_partitioned` where _PARTITIONTIME BETWEEN TIMESTAMP('2019-02-02') AND TIMESTAMP('2019-02-02')
group by daydate
I would expect to see the aggregated number for each column.
I wonder if the issue is with the regex expression?
You can treat them as simple key/value pairs and then do the aggregation on top of it. Something like:
select
substr(CAST((DATE) AS STRING),0,8) as daydate,
split(x,':')[safe_offset(0)] as key,
cast(split(x,':')[safe_offset(1)] as float64) as value
from `gdelt-bq.gdeltv2.gkg_partitioned`,
unnest(split(GCAM, ',')) as x
where _PARTITIONTIME BETWEEN TIMESTAMP('2019-02-02') AND TIMESTAMP('2019-02-02')
Hope this helps.
This should get you 2 (anew), 25 (ridanxietycnt), 275 (wordcount), in this order
SELECT
SAFE_CAST(REGEXP_EXTRACT('wc:275,nwc:267,c1.3:2,c12.1:25,c12.10:39,c12.12:21,c12.13:4', r'c1.3:(\d+)') as FLOAT64) anew,
SAFE_CAST(REGEXP_EXTRACT('wc:275,nwc:267,c1.3:2,c12.1:25,c12.10:39,c12.12:21,c12.13:4', r'c12.1:(\d+)') as FLOAT64) ridanxietycnt,
SAFE_CAST(REGEXP_EXTRACT('wc:275,nwc:267,c1.3:2,c12.1:25,c12.10:39,c12.12:21,c12.13:4', r'wc:(\d+)') as FLOAT64) wordcount