Search code examples
excelexcel-2007

Formula to strip fraction values from text strings?


My company has a lot of odd sizes that get specified via text strings, and we have a spreadsheet that does not currently have a calculation to strip these for use in a second column (which uses the raw number values.) Example strings below:

24 1/2 x 23 1/4 x 1 - EXACT
29 1/4 x 13 1/2 x 1 - EXACT
19 x 35 x 1

And so on. I had a partially complete formula to extract the leading value up to the first X, but cannot figure out an efficient way to extract the second value. My initial formula (which I've lost, unfortunately) was using a combination of Left, Mid, and Search in order to pull the values to the left of the first "x", since that will always follow a dimension value. Can anyone help?

EDIT: What I am looking for are two columns to populate to the right, one with the first measurement (example one would be parsed to 24 1/2 in Column B) and one with the second (example one would be parsed to 23 1/4 in Column C).


Solution

  • EDIT#1:

    With your text in A1 , in B1 enter:

    =TRIM(MID(SUBSTITUTE($A1,"x",REPT(" ",999)),COLUMNS($A:A)*999-998,999))
    

    In C1 enter:

    =TRIM(MID(SUBSTITUTE($A1,"x",REPT(" ",999)),COLUMNS($A:B)*999-998,999))