Search code examples
google-sheetsgoogle-sheets-formula

Extract portion of retrieved string in Google Sheets


"substitute(index(importhtml("https://site_name.com/quote.ashx?t="&E14,"table",10),8,2),"","")" returns a text value; "'0.72 (13.28%)'"

The return value can vary in length.

I need to extract either just the 0.72 or 13.28 so I can then convert to numeric format.


Solution

  • Extracting only 1 value out of 2 from indefinite length of string

    Based on your question I assume that you only want to get 1 value every 2 values being returned by the importhtml function. I would suggest using this formula to extract it

    =FILTER(SPLIT(A1, " "), ISERROR(SEARCH("-", SPLIT(A1, " "))))
    

    It will return 1 row only, if you are looking to have it as 1 column instead please enclose it on a transpose function.

    Output:

    image

    References:

    Split Function

    Filter

    Search