Strange value from ImportXML - google-sheets

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

Related

Remove ,0000 number format from multiple formula on one cell

Hello stackoverflow i want to ask about how to remove those ,00000 (on screenshot above) im using multiple formula and "Format > Number > option" doesnt work for me
Thank you
You can use =ROUND() or =ROUNDDOWN() function to remove the decimal.
Your AVERAGEIF formula should look like this:
=ROUND(AVERAGEIF($B$13:$B;"Pragmatic Play";$E$13:$E))
OR
=ROUNDDOWN(AVERAGEIF($B$13:$B;"Pragmatic Play";$E$13:$E))
Example:
References:
ROUND
ROUNDDOWN
For currency values you can also use =DOLLAR() (depending on spreadsheet's local setting) which allows you do determine the number of decimals:
=DOLLAR(AVERAGEIF($B$13:$B;"Pragmatic Play";$E$13:$E);2)&" (other things)"

Conditional Formatting with 2 Sheets not working

im trying to mark matching URLs red.
I have two sheets with URL Data.
My custom Formula looks like this:
match(A2,indirect(Sheet2!A2:A),0)
wondering why there is an error if i use =match(A2,indirect(LostURLs!A2:A),0)
so with the additional =
Anyways both methods are not working and im wondering why?
Indirect excepts the first argument to be "a cell reference as string".
So please try
=match(A2,indirect("LostURLs!A2:A"),0)
and see if that works?
Note: depending on if you want the formatting for a single cell, a column or a row you may have to use a dollar sign in the first argument of the match() function
E.g: If you'd want to repeat the formatting for column A, you would have to use
=match($A2,indirect("LostURLs!A2:A"),0)
For row 2 that would be:
=match(A$2,indirect("LostURLs!A2:A"),0)
and for a single cell
=match($A$2,indirect("LostURLs!A2:A"),0)
NOTE: Depending on your locale, you may have to change the comma's to semi-colons.
perhaps try:
=MATCH(A2; INDIRECT("LostURLs!A2:A"); 0)

Spreadsheets get unique names but ignore blank cells

I would like to use spreadsheets to get all unique names from Column A in a table but in the same time I would like blank cells to be ignored. So far I've got this formula that returns all of the unique names from column A but I don't know how to go about ignoring blank cells and not repeating values that have once been added previously.
Here is how my document looks so far. As you can see everything stops after Megan because there is a blank cell.
=IFERROR(INDEX($A$2:$A$90, MATCH(0, COUNTIF($I$10:I10, $A$2:$A$90), 0)), "")
Searched long and wide but came up with nothing, if anyone has any idea how one could do that I would really appreciate it. Thanks!
=unique(A2:A) should work
=unique(filter(A2:A,A2:A<>"")) to also ignore blanks
Yet another hack
=SORT(UNIQUE(A2:A))
Technically, this does not remove the blank result. But nonetheless puts it at the end of the list. You'll also benefit from the sort if you need it. 😁
You can use query:
=unique(query(A2:A,"select A where A<>''"))
You can use this code:
=IFERROR(INDEX($A$2:$A$90, MATCH(0, INDEX(COUNTIF($I$10:I10, $A$2:$A$90)+($A$2:$A$90=""), ), 0)), "")
should work

VLOOKUP within IMPORTRANGE

I'm trying this function on Google spreadsheet without success in order to gather in a sheet a value after a VLOOKUP:
=importrange("otherurl";cell("address";vlookup(value("201608"),"All_nodevice!$A$16:$C$1000",2,false)))
I get a general error.
Does IMPORTRANGE support this kind of functionality?
What I need to do is to extract data from the cell of another sheet that has the value 201608 on its left. Since IMORTRANGE wants a cell pointer such as $A$12, I thought to do these steps:
search with a lookup the value.
convert the result in a cell pointer.
I found the right way. May be it could be useful for someone else.
=VLOOKUP(201608;IMPORTRANGE("sheet url"; "All_nodevice!$A$16:$C$1000"); 2; 0)
or
=query(IMPORTRANGE("sheet url";"All_nodevice!$A$16:$C$1000");"select Col2 where Col1=201608 limit 1")
Just the ID worked for me as well instead of the URL. I had my numbers as text, so kept getting an error at first. Silly mistake, but what you are looking up probably has to be the same kind of thing (text vs numbers).
=vlookup(Q6,IMPORTRANGE("1m9IN4_NH717VATXWLnPgTvrKxnRHwtH8z-f38r9F3zY","Props!A1:Bb400"),38,false)

How to use Google Spreadsheet ADDRESS function to create a range

I'm trying yo create a formula in google spreadsheet that calculates the maximum value for all the cells above the current cell, in a way I can copy it to any cell and still workss. I tried using the ADDRESS function like this:
=MAX(ADDRESS(1;COLUMN()):ADDRESS(ROW()-1;COLUMN()))
But I get an parse error. I tried many variants of this code, but always get an error. Apparently, the ADDRESS function is not allowed as part of a range.
Is there any way to create a reference to a range based on the current cell position?
Was stuck on something very similar. Something like this should work.
=MAX(INDIRECT(1, COLUMN()) & ":" & ADDRESS(ROW()-1, COLUMN())))
This might be useful too if you want to get the sting address for a range:
=ADDRESS(row(A3:A6),COLUMN(A3:A6))&":"&ADDRESS(row(A3:A6)+rows(A3:A6)-1,COLUMN(A3:A6)+COLUMNS(A3:A6)-1)
This will return a string on the range, in this case
$A$3:$A$6
Using the INDIRECT function on your range string returns a range reference, which can then be used in a formula, eg.
INDIRECT(ADDRESS(1;COLUMN()):ADDRESS(ROW()-1;COLUMN()))
should work in
MAX(INDIRECT(ADDRESS(1;COLUMN()):ADDRESS(ROW()-1;COLUMN())))

Resources