Search code examples
excelcsvexcel-formulacell

two values in a excel cell


I have a cell in excel with a range value: a-b, example: '23.5-34.7'

I want compute in another cell the following math: b-a (34.7-23.5), which would be the code in excel to do that? If the 2 values belong to the same cell how can I define them as a 2 different values in excel?

Thank you!


Solution

  • Suppose that the value "23.5-34.7" is stored inside cell A1 you can get

    • 23.5 with the formula =MID(A1,1,FIND("-",A1,1)-1)
    • 34.7 wth the formula =MID(A1,FIND("-",A1,1)+1,999)