Extracing numbers in different formats from cells in Google Sheets - google-sheets

I want to extract numbers from cells that contains text and numbers in Google Sheets. However, the format of the numbers is inconsistent. Thousands separator and decimal separator are not used consistently.I have some mock data below:
Column A
in the amount of $1910.06 on
una transferencia de 15,01 EUR a la
received 650,40 € on
in the amount of 1.009,62 EUR
montant de € 16.19 vers
in the amount of 99.77 PLN
in the amount of CDN$ 1209.23
I am looking for the following output in column B:
Column B
1910.06
15.01
650.04
1009.62
16.19
99.77
1209.23
I was trying to work with REGEXEXTRACT but don't know what the correct parameters are to make this work.
Many thanks for your help.

use:
=ARRAYFORMULA(REGEXEXTRACT(SUBSTITUTE(A1:A7&"", ",", "."), "\d+(?:.\d+)?")*1)
update:
=ARRAYFORMULA(IFNA(REGEXEXTRACT(SUBSTITUTE(IF(REGEXMATCH(A1:A10&"", "\d+\.\d{3}"),
SUBSTITUTE(A1:A10, ".", ), A1:A10), ",", ".")&"", "\d+(?:.\d+)?")*1))

Use this formula
=ArrayFormula(IF(A2:A="",,
TRIM(REGEXREPLACE(REGEXREPLACE(A2:A,"[A-Za-z]+", ""), "[!##$%€^&*()]", ""))))

Related

How to find if string contains a specific word in Google Sheets

I have one column with comma separeted strings and a several with words that can be in these strings. I have to find if a a word from a column name is in a string. I used a regexmatch formula, but it doesn't distinguisch TV from TV remote. How can I fix this?
Mu formula:
arrayformula(if(L1<>"";if(REGEXMATCH($K$2:$K;L$1)=TRUE;"Wybrano";"");""))
My data
Or if it will be simplier I have to count how many times the certain word occured in the column with strings.
Can you try:
=MAKEARRAY(ROWS(K2:INDEX(K2:K;ROW(LOOKUP("ZZZ";K:K))));COUNTA(L1:1);LAMBDA(r;c;IF(LEN(INDEX(K2:K;r));IF(REGEXMATCH(INDEX(K2:K;r);INDEX(L1:1;;c)&"(?:,|$)");"Wybrano";);)))
Adjust the column range here COUNTA(L1:1) to something like COUNTA(L1:P1) or so depending on your dataset.
try:
=IFNA(BYCOL(L1:P1, LAMBDA(y, BYROW(K2:K, LAMBDA(x,
IF(MATCH("*"&y&"*", x, ), "Wybrano"))))))

Change comas on column show with percentajes tableau

I had one column with the values formated the following way: 12,48. To be able Tableau to interpret it as %, I have changed de number format by Right Click on Measures>Default Properties>Number Format>Percentage with 2 decimal places. But now my data is record on the column like this: 1248,00% and I need it to be 12,48%
if you choice 'Percentage with 2 decimal places' it your value (12,48) *100
the right where to do it is:
Measures>Default Properties>Number Format> numer personalisation> add ' %' on sifix

Convert 20,385.0 into 20 385,00 $ in a Google Spreadsheet [duplicate]

I have cells with data in a format:
12 345,67 EUR
(twelve thousand three hundred forty five EUR and sixty seven cents)
I can't change this format (I need to copy&paste a lot of those into the spreadsheet from another source).
I'm trying to make some calculations with it but it shows me #VALUE! error saying it's a text and cannot be coerced to a number. I tried to format those cells as custom number format ##,###.00" EUR" but it doesn't work.
try:
=REGEXREPLACE(A1; "[ EUR]"; )*1

google spreadsheets currency format with suffix

I have cells with data in a format:
12 345,67 EUR
(twelve thousand three hundred forty five EUR and sixty seven cents)
I can't change this format (I need to copy&paste a lot of those into the spreadsheet from another source).
I'm trying to make some calculations with it but it shows me #VALUE! error saying it's a text and cannot be coerced to a number. I tried to format those cells as custom number format ##,###.00" EUR" but it doesn't work.
try:
=REGEXREPLACE(A1; "[ EUR]"; )*1

how to extract 10 digit phone number from a cell in Google sheet

I have multiple rows on Google sheet, each cell in the row contains emails messages which have loads of text and symbols etc and also phone numbers, I need to extract these phone numbers, the phone numbers are 10 digits no spaces.
I tried regexextract on google sheet but it gives me only the first number
=REGEXEXTRACT(E2,"\d+")
how do I extract multiple phone numbers data which are present in each cell on Google sheet.
try:
=IFERROR(SPLIT(REGEXREPLACE(A1:A, "\D+", " "), " "))
player0's answer is already good. But if you only need to extract 10 digit numbers and not include other numbers in the cell (e.g. 123), make sure to exclude the non-10 digit numbers.
I did modify the other answer to filter out those non-10 digit numbers using another regexreplace before using split.
Formula:
=split(regexreplace(regexreplace(A1,"\D+", " "),
"^\d{1,9}\s|\s\d{1,9}\s|\s\d{1,9}$|\d{11,}"
, " "), " ")
Patterns to exclude:
We need to exclude any numbers that aren't 10 succeeding digits. These are the following possible patterns.
^\d{1,9}\s less than 10 numbers at the start
\s\d{1,9}\s less than 10 number in between
\s\d{1,9}$ less than 10 numbers at the end
\d{11,} more than 10 numbers
Appending them all using | resulting into "^\d{1,9}\s|\s\d{1,9}\s|\s\d{1,9}$|\d{11,}"
Sample Cell Value:
123asd1234567890oia123joieqw9876543210asda123asd12345678910
Output:
EDIT:
It seems it is having an issue on multiple occurrences when the string has spaces in between. If script is an option, I do recommend this one below.
Code:
function get10DigitNums(string) {
var regex = /[^\w](\d{10})[^\w]|^(\d{10})[^w]|[^w](\d{10})$/g;
var result = [];
do {
m = regex.exec(string);
if (m) {
m.shift();
result.push(m);
}
} while (m);
return [result.flat().filter(Boolean)];
}
Output:
I needed to do sth similar (extract all phone numbers removing spaces and letters/ other symbols) and I think I found an easier solution:
=VALUE(REGEXREPLACE(F3;"[^[:digit:]]";""))
Example:
F3 = "32 3215-2263" ====> Result "3232152263"
Hope it helps.

Resources