Convert phone numbers with brackets in Google spreasheet - google-sheets

Trying to convert below Phone numbers patterns into single pattern with open and close brackets for first 3 digits using formula only in Google spreadsheet.
214-7671378
214660-9212
214.412-2034
(972) 223-6473
214 502 7196
To
(214) 767-1378
(214) 660-9212
(214) 412-2034
(972) 223-6473
(214) 502-7196

In google-spreadsheet
=text(REGEXREPLACE(TEXT(A1,"#"),"\D+",""),"(###) ###-####")

Related

How can I split a string and sum all numbers from that string?

I'm making a list for buying groceries in Google Sheets and have the following value in cell B4.
0.95 - Lemon Juice
2.49 - Pringle Chips
1.29 - Baby Carrots
9.50 - Chicken Kebab
What I'm trying to do is split using the dash character and combine the costs (0.95+2.49+1.29+9.50).
I've tried to use Index(SPLIT(B22,"-"), 7) and SPLIT(B22,"-") but I don't know how to use only numbers from the split string.
Does someone know how to do this? Here's a sample sheet.
Answer
The following formula should produce the result you desire:
=SUM(ARRAYFORMULA(VALUE(REGEXEXTRACT(SPLIT(B4,CHAR(10)),"(.*)-"))))
Explanation
The first thing to do is to split the entry in B4 into its component parts. This is done by using the =SPLIT function, which takes the text in B4 and returns a separate result every time it encounters a specific delimiter. In this case, that is =CHAR(10), the newline character.
Next, all non-number information needs to be removed. This is relatively easy in your sample data because the numbers always appear to the left of a dash. =REGEXEXTRACT uses a regular expression to only return the text to the left of the dash.
Before the numbers can be added together, however, they must be converted to be in a number format. The =VALUE function is used to convert each result from a text string containing a number to an actual number.
All of this is wrapped in an =ARRAYFORMULA so that =VALUE and =REGEXEXTRACT parse each returned value from =SPLIT, rather than just the first.
Finally, all results are added together using =SUM.
Functions used:
=CHAR
=SPLIT
=REGEXEXTRACT
=VALUE
=ARRAYFORMULA
=SUM
Firstly you can add , symbols start and ends of numbers with below code:
REGEXREPLACE(B4,"([0-9\.]+)",",$1,")
Then split it based of , sign.
SPLIT(A8, ",")
Try below formula (see your sheet)-
=SUM(ArrayFormula(--REGEXEXTRACT(SPLIT(B4,CHAR(10)),"-*\d*\.?\d+")))

Investment sheets has an error while converting usd to eur

I get an error with my code: =IF(ISNUMBER(SEARCH("$",B3),RIGHT(B3,LEN(B3)-1)*A1000,B3))
The error is: Incorrect number of arguments for IF. Expected between 2 and 3 arguments, but found 1 arguments.
It should convert b3 to euros if there is a "$" before the number.A1000= usd/eur in numbers.
The sheet: https://docs.google.com/spreadsheets/d/1RnYi9H70fqS5wy1OQO2jex7xdNl-1kFLVbm3uDjejTg/edit?usp=sharing .I am trying in G/H 29
try:
=IF(ISNUMBER(SEARCH("$"; B3)); RIGHT(B3; LEN(B3)-1)*A1000; B3)

Extracting numbers with REGEXEXTRACT that might have a comma or dot

I have a list of numbers in a few formats that may or may not include a dot and a comma. The numbers are locked in a string. For example:
hello 1,000 goodbye
hola 2,000.12 ciao
Hallo 3000.00 Auf Wiedersehen
How can I extract the numbers?
I don't care if the comma is added but the dot is obviously important.
I need the regular_expression to be used in REGEXEXTRACT (and the rest of the REGEX formulas.
The output should be:
1000
2000.12
3000.00
Supposing that your raw data is in A2:A, use this in B2 (or the second cell) of an otherwise empty column:
=ArrayFormula(IF(A2:A="",,IFERROR(VALUE(REGEXEXTRACT(A2:A,"\d[\d,\.]*\d")))))
The REGEX portion reads, in plain English, "Extract any portion that starts with a digit followed by any number of digits, commas or periods (or none of these) and ends with a digit."
You will likely want to apply Format > Number > Currency to the results column.

How to insert comma as superscript in google spreadsheet

I want to add comma in spread sheet as a superscript like :
in this ->> ¹,²
comma is not as superscript. Is there any way out for comma to be added as superscript in google spreadsheet?
For 1 and 2 and many others, there is a function available in sheet like =char(178)
however I am ot able to find the code for comma.
Answer:
As there is no Unicode for a superscript comma, you can not do this.
More Information:
Not all characters have superscript-versions set in unicode. You can see the full list of available superscript characters here.
You can either use the dot operator (U+2265) ⋅, or the modifier letter apostrophe (U+02BC) ʼ as separators instead, if you wish to hard code this. I am of the personal opintion that the dot operator looks more like a comma, but they both appear as below:
¹⋅² (dot operator)
¹ʼ² (modifier letter apostrophe)
As Google Sheets isn't a word processing application, there is no direct in-built way to make text appear as superscript, akin to <sup>1,2</sup> in HTML:
1,2
References:
Unicode subscripts and superscripts - Wikipedia

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|"),"|")

Resources