google-sheet : extract sub text from text - google-sheets

I have cells and each contains these text :
my_col_10x50_new
my_col_20x40_new
my_col_30x30_new
my_col_15x50_new
I want correspondingly to extract just the number parts and make a "xx and xx" format like these :
10 and 50
20 and 40
30 and 30
15 and 50
Anyone can help ?

You can try a combination of substitute and regex extract:
=SUBSTITUTE(REGEXEXTRACT(A1, "[0-9]+x[0-9]+"),"x", " and ")
The REGEXEXTRACT extracts the numbers along with the x in the middle and substitute replaces the x with the 'and' in the middle keeping the numbers as is.

use:
=INDEX(IFNA(REGEXREPLACE(REGEXEXTRACT(A1:A, "\d+x\d+"), "x", " and ")))

Another option:
=INDEX(SPLIT(SUBSTITUTE(A1:A,"x"," and "),"_"),0,3)

Related

Is there a function to split cells that will ignore delimiters within quotation marks?

I am trying to separate CSV text into columns using a formula in google sheets, but when I do it ends up separating strings with commas within quotes.
https://docs.google.com/spreadsheets/d/1bqG82qVNv8_VaSarVHFJ4dn78khf_2nNajRe9-ulXL4/edit?usp=sharing
For example when I use
=split(A1,","):
119,"6.65","","en","Ezuri, Renegade Leader","6734497c-16f0-4c4b-ba24-337333511fc6","1","rare","e9544132-bbb5-4ec4-af82-dad56e5091af","som","Scars of Mirrodin"
Gets turned into:
119
6.65
en
Ezuri
Renegade Leader
6734497c-16f0-4c4b-ba24-337333511fc6
1
rare
e9544132-bbb5-4ec4-af82-dad56e5091af
som
Scars of Mirrodin
Any help would be much appreciated!
=SPLIT(REGEXREPLACE(A1,"""?,""","🤑"),"🤑")
Steps:
Replace "," and ," with 🤑:
"119🤑6.65🤑🤑en🤑Ezuri, Renegade Leader🤑6734497c-16f0-4c4b-ba24-337333511fc6🤑1🤑rare🤑e9544132-bbb5-4ec4-af82-dad56e5091af🤑som🤑Scars of Mirrodin"
and split by 🤑:
119
6.65
en
Ezuri, Renegade Leader
6734497c-16f0-4c4b-ba24-337333511fc6
1
rare
e9544132-bbb5-4ec4-af82-dad56e5091af
som "
Scars of Mirrodin"""

Leaving behind just numbers in Google Sheets

I have a column in Google Sheets that has phone numbers with the following formats:
(904) 123 4567
+62 123 4567
+12345678
How can I create another column that automatically removes "+", "(", ")" and spaces to produce 9041234567?
Thanks
You can replace all non-digits with nothing.
=ArrayFormula(regexreplace(A2:A4&"", "\D+",))
Change range to suit and/or use an open-ended range
=ArrayFormula(if(len(A2:A), regexreplace(A2:A4&"", "\D+",),))
You can just use REGEXREPLACE to remove the characters you don't want:
=REGEXREPLACE(A1; "[ \(\)\+]"; "")
The expression used [ \(\)\+], removes the character space, right and left parenthesis and the plus sign. Simply add all other characters you want to remove.

How to split text using numbers as a delimiter in Google Sheets using a formula

I know how to split text using other delimiters such as a comma, equal sign etc. I am having trouble for examples that require a number delimiter.
A typical split formula that uses a comma delimiter would look like this:
=SPLIT(A1, ",")
I am struggling with splitting text that looks something like this. The delimiter here is a number.
This is a random text of 20 characters but could be 30 characters as well.
Output should be
This is a random text of | 20 | characters but could be | 30 | characters as well.
Please help. Thanks
Try the following:
=SPLIT(REGEXREPLACE(A1,"\d+","|$0|"),"|")
Maybe better, to remove spaces:
=SPLIT(REGEXREPLACE(A1,"\s*(\d+)\s*","|$1|"),"|")

Concatenate Double Quote for a large number without E+

I have some really big numbers with me in an excel. I need to concatenate double quote in both the end of each number.
Like I have number:
20150909110448800000000000 in A1
20150909105944800000000000 in B1
and 20150909110448700000000000 in C1
And i need the output like :
"20150909110448800000000000","20150909105944800000000000","20150909110448700000000000" in D1
I have tried changing the format of cell D1 by selecting Format Cell --> Number --> Custom --> 0 --> "OK"
Then Put the concatenate function in D1.
=CONCATENATE(CHAR(34),A1,CHAR(34),",",CHAR(34),B1,CHAR(34),",",CHAR(34),C1,CHAR(34))
But it is giving output as :
"2.01509091104488E+25","2.01509091059448E+25","2.01509091104487E+25"
Instead of what I expect.
Can you please provide the solution to get rid of this E+ in the output?
You can convert your numbers to text and then concat. As you output will be text if you add " ".
=CONCAT(CHAR(34),TEXT(A1,0),CHAR(34),TEXT(B1,0),CHAR(34))

Split string with % as TEXT format and preserve % symbol

I'm trying to split a string by delimiter "a". I will be performing regexmatches on the first column. However, most values are being split into NUMBER formats that cannot be override. Especially I would like to preserve the percent entries as text format.
Current, only b90 is recognized as ISTEXT
b90a100a100 -> b90 100 100
90%a100a100 -> .9 100 100
100a100a100 -> 100 100 100
Target, I would like at least column A (b90, 90%, 100) to be text.
b90a100a100 -> b90 100 100
90%a100a100 -> 90% 100 100
100a100a100 -> 100 100 100
A simple method is using TRIM or SUBSTITUTE, whose output is always ISTEXT:
=ARRAYFORMULA(TRIM(SPLIT(A1:A3,"a")))
Or
=ARRAYFORMULA(SPLIT(A7:A9,"a")&"")
Please try:
=REGEXEXTRACT(A1,REPT("(.*)?a",LEN(A1)-len(SUBSTITUTE(A1,"a","")))&"(.*)?")
LEN(A1)-len(SUBSTITUTE(A1,"a","")) is a number of letters "a"
REPT("(.*)?a", times) & "(.*)?" makes regex like "(.*)?a(.*)?a(.*)?"
REGEXEXTRACT splits string into strings.
Format the three cells concerned as Plain text and apply Data > Split text into columns... with a as Custom Separator.

Resources