1
votes

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?

2

2 Answers

2
votes

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
1
votes

You might wrap your formula in:

1*substitute(index( <your formula> ;3);" SEK";"")