Search code examples
regexgoogle-sheetsgoogle-sheets-formula

Getting value between '-' in google sheets


Im trying to get the number between '-' and '-' in google sheets but after trying many things I still havent been able to find the solution.

Data record 1
England Premier League
West Ham vs Crystal Palace
2.090 - 3.47 - 3.770

Expected value = 3.47

Data record 2
England League Two
Carlisle vs Scunthorpe
2.830 - 3.15 - 2.820

Expected value = 3.15

Hopefully someone can help me out


Solution

  • Try either of the following

    option 1.

    =INDEX(IFERROR(REGEXEXTRACT(AE1:AE4," \d+\.\d+ ")*1))
    

    option 2.

    =INDEX(IFERROR(REGEXEXTRACT(AE1:AE4,".* - (\d+\.\d+) ")))
    

    (Do adjust the formula according to your ranges and locale)

    enter image description here