Question

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).

Was it helpful?

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))

OTHER TIPS

Copy the column into ColumnB, apply Text to Columns to the copy, with x as the delimiter, and delete the column on the right.

Coming up with the answer was the easy part for me. The hard part is figuring out how to relay it to you. Drop the table below into your first 2 columns. The 3rd column will be the result of the formulas:

Names     Formulas                                        Results
String    29 1/4 x 13 1/2 x 1 - EXACT
1stX      =FIND("x",B1)                                   8
2ndX      =FIND("x",B1,B2+1)                              17
End       =IF(ISERR(FIND("-",B1)),LEN(B1),FIND("-",B1))   21
1st Arg   =LEFT(B1,B2-2)                                  29 1/4
2nd Arg   =MID(B1,B2+2,B3-B2-2)                           13 1/2
3rd Arg   =MID(B1,B3+2,B4-B3-2)                           1

Once you're comfortable with these, you can save space by combining these formulas, i.e. replace B2 with FIND("x",B1). You can do that to come up with just 1 formula for each argument.

Also, if you need to convert the fractions as regular decimals, use Value() to convert them, i.e. 29 1/4 to 29.25.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top