Simpler way to reformat text as numbers in Google Sheets - google-sheets

I have a Google Sheets cell with content like this: £5,300.23 and I can't find a simple way to reformat it as numbers.
My current solution is in three steps:
remove the currency sign (= substitute(A1, "£", "")),
paste-special into a new column,
then format the column as 'number'.
Is there a better way?

Use Value on the result of substitute:
=VALUE(SUBSTITUTE(A1,"£",""))

you can do simply:
=SUBSTITUTE(A18, "£", )*1
and arrayformula would be:
=ARRAYFORMULA(SUBSTITUTE(A18:A20, "£", )*1)

Related

Google sheets formula to remove currency sign

Which formula can I use to remove the currency sign?
Anything smarter than: REPLACE(value,0,1)?
Your question is way too vague.
Having said that, let's cover different conditions
Cell as TEXT =C1*1
Cell as NUMBER =N(C2)
Raw Value =("$-123.55")*1
Try the following
=SUBSTITUTE(value, "$", "")

Can I use an arrayformula with a split arrayformula inside it?

Trying to break apart rows containing numbers like "198,183,158,315,274" by their comma, and then average them out and divide them by a singular number; using arrayformula. It only produces one row of result and it's incorrect though?
Here is my test sheet, editable
Thanks for any help.
try:
=ARRAYFORMULA({"Average"; IF(A4:A="",,
IFNA((MMULT(1*IFERROR(SPLIT(INDIRECT("A4:A"&
MAX(IF(A4:A="",,ROW(A4:A)))), ",")),
ROW(INDIRECT("A1:A"&COLUMNS(SPLIT(A4:A, ","))))^0)/
(1+LEN(REGEXREPLACE(A4:A&"", "[0-9\. ]", ))))/B1))})
spreadsheet demo
Another solution:
=ArrayFormula({"Average";(ArrayFormula(mmult(N(array_constrain(ArrayFormula(IFERROR(SPLIT(A4:A8,","))),MATCH(2,1/(A4:A8<>""),1),5)),sequence(Columns(ArrayFormula(IFERROR(SPLIT(A4:A8,",")))),1)^0)/mmult(N(array_constrain(if(ArrayFormula(IFERROR(SPLIT(A4:A8,",")))>0,1,0),MATCH(2,1/(A4:A8<>""),1),5)),sequence(columns(ArrayFormula(IFERROR(SPLIT(A4:A8,",")))),1)^0)))/$B$1})

Query to select a large range of columns without manually entering each column Google Sheets

I am using the solution presented in this post:
https://webapps.stackexchange.com/questions/101926/google-sheets-query-to-select-a-large-range-of-columns-without-manually-entering
But now I need to query data from a different spreadsheet. I know the importrange requires the use of 'Col' to specify the column. However, I don't know how to change this string:
=arrayformula(join(",", substitute(address(1, column(C:F), 4), "1", "")))
you can use:
=ARRAYFORMULA(JOIN(",", "Col"&COLUMN(C:F)))

String manipulation on column in Google Sheet Query

Is it possible to do a string manipulation of data in a Google Sheet query?
I want to do something like the following:
=QUERY(someRange!A:Z, SELECT A, SUBSTITUTE(B, "OCH", ""))
The idea being that all rows' column B is 'OCHXXXXXXX' where X is a digit. I would like to get rid of the chars.
On a side note... Is this possible in MySQL? How?
This formula might work for you:
=QUERY({Sheet1!A:A,ARRAYFORMULA(SUBSTITUTE(Sheet1!B:B,"OCH","")),Sheet1!C:Z})
I would suggest:
=arrayformula(REGEXREPLACE(somerange!B:B, "OCH", ""))

Importrange() where the source columns/rows change

I have an importrange("key", "sheet1!D" & targetRow) formula, but I also need the column of the importrange() to be dynamic too in case I add/delete columns in the source data:
E.g. importrange("key", "sheet1!" &targetColumn &targetRow)
I researched query() language but being forced to use Col1, Col2 etc instead of named column identifiers makes this useless for what I'm trying to achieve.
Can someone help me with this? Easiest way to get column letters without a script? Thanks very much.
I've figured out a somewhat inelegant workaround:
=IMPORTRANGE("key", "Sheet!" & IMPORTRANGE("key", "Dept") & targetRow)
Where "Dept" is a single-cell named range that contains the column letter of the column I want.
The column letter (e.g. 'K') is the result of the following formula:
=substitute(address(row(K6), column(K6),4), row(K6),"")
Is there really no easier/more robust way of doing this? This will be used to calculate bonuses so it's actually a very critical spreadsheet.

Resources