Google Sheets VALUE function gives wrong result - google-sheets

I have a cell: 1:03.45 which I converted into a number using
=VALUE(REPLACE(REPLACE(F10;2;1;" ");5;1;" "))
Works perfectly, the result is 10345. Now I tried the cell 1:04.04 with the same functions, and I got 36985.
What causes it to happen?
Also, it does the same for 1:04.05 it gives 36986.

use:
=ARRAYFORMULA(REGEXREPLACE(A1:A3, "\D+", )*1)

Related

Google Sheets: ArrayFormula: Add Previous Value Err If First Value Is Text

The ArrayFormula I'm using is doing a cumulative calc, so col D is cumulative... eg =D1+C2 etc. Works fine when I create the ArrayFormula except for the first calc - since D1 is a header (text), not a number.
I tried an IF(), to check IsNumber(), but no good, same error. Any suggestions on how to correct this error?
Sorry, just fixed it. I had tried to use IFERROR(), but did it incorrectly before, now works when I use:
=ArrayFormula(iferror(D1:D1957+C2:C1958,C2:C1958))

If & match function together in spreadsheets

I wrote this formula in the spreadsheet: =if(match(AR$2,$A5:$E5,0),AR$2,"")
If there is no match, it's supposed to leave the cell blank, instead it gives #N/A. but if there is a match, it gives the value. Can anybody show me how to correct this? thanks.
You could use iferror
try something like:
=iferror(if(match(AR$2,$A5:$E5,0),AR$2),"")

Use cell reference inside google spreadsheet function

I am using Google Spreadsheet function.
This formula works fine.
=ImportXML("https://www.google.com/finance?q=SHA:000001", "//span[#class='pr']")
The string SHA:000001 is contained in cell B4. I would like to use cell reference. So, I changed to formula to
=ImportXML("https://www.google.com/finance?q=" + B4, "//span[#class='pr']")
Unfortunately, this did not work. The value returned is #VALUE!. How should the correct formula look like?
You need to use an ampersand not a plus sign:-
=ImportXML("https://www.google.com/finance?q="&B4, "//span[#class='pr']")

Strange value from ImportXML

I use the following importXML:
=IMPORTXML("http://www.morningstar.se/guide/quicktake?id=0P00009NT9"; "/html/body/div[2]/div/div[1]/div/div[4]/div[1]/div[3]/table[1]/tbody/tr[1]/td[2]")
to scrape text into my cell and two cells across the row where I get the latest GAV: 116,17 SEK.
I would like to use that number value. I have tried with =LEFT(A3;3) but that only gives an error.
How might I retrieve it?
I don't know if 'SEK' is always going to be at the end of the string, but for your present example see if this works:
=ArrayFormula(REGEXEXTRACT(JOIN(" "; IMPORTXML("http://www.morningstar.se/guide/quicktake?id=0P00009NT9"; "/html/body/div[2]/div/div[1]/div/div[4]/div[1]/div[3]/table[1]/tbody/tr[1]/td[2]")); {"^(.+)\s\d"\ "([0-9,]+)"}))
If you only need the number and not the preceding text:
=ArrayFormula(REGEXEXTRACT(JOIN(" "; IMPORTXML("http://www.morningstar.se/guide/quicktake?id=0P00009NT9"; "/html/body/div[2]/div/div[1]/div/div[4]/div[1]/div[3]/table[1]/tbody/tr[1]/td[2]")); "([0-9,]+)"))+0
You might wrap your formula in:
1*substitute(index( <your formula> ;3);" SEK";"")

Google Sheets right() in Sum in Arrayformula returning false values

I've a column of sample data where each cell is either blank or (3 alpha chars, 1 white space, 1 digit). For example:
I need to check if the cell begins with "GTR" or "DBT", then return the number, and sum the return of the column. I'm using the formula below:
=ARRAYFORMULA(sum(IF(OR(left(A1:A10,3)="GTR",left(A1:A10,3)="DBT"),VALUE(right(A1:A10,1)),0)))
The problem is that instead of returning 20, it returns 52.
In fact it appears to return the last char of any cell in the range. (eg. if "A5" has a value of 'someText' the formula returns an error because value() can't parse 't' into a number.
I'd like to know if anyone can tell me how to solve this problem, or if there's something wrong with my formula?
Here's an example of this problem in a Google Sheet:
https://docs.google.com/spreadsheets/d/1XNVUWhI43UW2ABrja8rmplmxhhkSu-je45F-9F_3GQM/edit#gid=0
Thanks,
Onji
The ArrayFormula plus OR will evaluate to TRUE if any of the cells in the range is in the codition, to overcome this remove the OR, and add an IF for every condition, as such:
=ARRAYFORMULA(sum(IF(left(A1:A10;3)="GTR";VALUE(right(A1:A10;1));0);IF(left(A1:A10;3)="DBT";VALUE(right(A1:A10;1));0)))
In addition to the solution of Kriggs, this formula should also work:
=ArrayFormula(sum(if(regexmatch(B3:B12, "GTR|DBT")=TRUE, right(B3:B12)+0,)))

Resources