Hello Mighty Excelers!
I'm stumped. I have formulae that extract numbers from imperial linear measurements which are formatted in specific ways, for example: 12' 11-13/16" or 11-13/16" (when there are no feet) or 11" (when there are no feet and no fraction) or 13/16" (when there are no feet and no whole inches).
The linear measurement string is in I7; the whole inches extract to M8; the numerator extracts to M9, and the denominator extracts to M10.
The formula in M8 works as it should when I7 is feet' inches-numerator/denominator" or inches-numerator/denominator" or inches" or 0-numerator/denominator".
If I don't specify 0- for 0 inches, here's the problem: when I enter into I7 13/16" or 14/16" or 15/16" (without whole inches), the formula in M8 works perfectly, i.e., returns 0 whole inches. If the denominator is 16 and the numerator is greater than 12, (for example, 50/16"), the formula works as intended. When I enter any other fraction into I7 (without whole inches), in M8 I get values in the 40000s, when it should still return 0 whole inches. The correct numerator and denominator are always returned, so the error must be in the M8 formula.
Here it is, ugly as it may be: =IF(I7="",0,IFERROR((MID(I7,SEARCH(" ",I7)+1,SEARCH("-",I7)-SEARCH(" ",I7)-1)*1),IFERROR((ABS(LEFT(I7,SEARCH("-",I7)-1))),IFERROR((ABS(LEFT(I7,SEARCH(CHAR(34),I7)-1))),IFERROR((IF(AND(ISERROR(SEARCH("-",I7)),ISNUMBER(SEARCH("/",I7))),0)),0)))))
I've stretched it out to make it easier to isolate here, with comments in red and square brackets:
=IF(I7="",0,
IFERROR(
(MID(I7,SEARCH(" ",I7)+1,SEARCH("-",I7)-SEARCH(" ",I7)-1)*1), [return the value between a space and a hyphen {if there are feet}]
IFERROR(
(ABS(LEFT(I7,SEARCH("-",I7)-1))), [return the value to the left of a hyphen {if there are no feet}]
IFERROR(
(ABS(LEFT(I7,SEARCH(CHAR(34),I7)-1))), [return the value to the left of a quote {if there are no feet and no fraction}]
IFERROR(
(IF(AND(ISERROR(SEARCH("-",I7)),ISNUMBER(SEARCH("/",I7))),0) [return 0 if there is no hyphen but there is a slash {if there are no feet and no whole inches}]
[I think the above line is where the error happens, or at least this line doesn't fix the error]
),0)))))
I've attached a zipped file of what I have so far. I had to zip it, as attaching an xlsx is apparently not supported.
If any of you kind gurus can please help me, I'd bestow upon you my fondest wishes!
Thank you so much,
Phillip
I'm stumped. I have formulae that extract numbers from imperial linear measurements which are formatted in specific ways, for example: 12' 11-13/16" or 11-13/16" (when there are no feet) or 11" (when there are no feet and no fraction) or 13/16" (when there are no feet and no whole inches).
The linear measurement string is in I7; the whole inches extract to M8; the numerator extracts to M9, and the denominator extracts to M10.
The formula in M8 works as it should when I7 is feet' inches-numerator/denominator" or inches-numerator/denominator" or inches" or 0-numerator/denominator".
If I don't specify 0- for 0 inches, here's the problem: when I enter into I7 13/16" or 14/16" or 15/16" (without whole inches), the formula in M8 works perfectly, i.e., returns 0 whole inches. If the denominator is 16 and the numerator is greater than 12, (for example, 50/16"), the formula works as intended. When I enter any other fraction into I7 (without whole inches), in M8 I get values in the 40000s, when it should still return 0 whole inches. The correct numerator and denominator are always returned, so the error must be in the M8 formula.
Here it is, ugly as it may be: =IF(I7="",0,IFERROR((MID(I7,SEARCH(" ",I7)+1,SEARCH("-",I7)-SEARCH(" ",I7)-1)*1),IFERROR((ABS(LEFT(I7,SEARCH("-",I7)-1))),IFERROR((ABS(LEFT(I7,SEARCH(CHAR(34),I7)-1))),IFERROR((IF(AND(ISERROR(SEARCH("-",I7)),ISNUMBER(SEARCH("/",I7))),0)),0)))))
I've stretched it out to make it easier to isolate here, with comments in red and square brackets:
=IF(I7="",0,
IFERROR(
(MID(I7,SEARCH(" ",I7)+1,SEARCH("-",I7)-SEARCH(" ",I7)-1)*1), [return the value between a space and a hyphen {if there are feet}]
IFERROR(
(ABS(LEFT(I7,SEARCH("-",I7)-1))), [return the value to the left of a hyphen {if there are no feet}]
IFERROR(
(ABS(LEFT(I7,SEARCH(CHAR(34),I7)-1))), [return the value to the left of a quote {if there are no feet and no fraction}]
IFERROR(
(IF(AND(ISERROR(SEARCH("-",I7)),ISNUMBER(SEARCH("/",I7))),0) [return 0 if there is no hyphen but there is a slash {if there are no feet and no whole inches}]
[I think the above line is where the error happens, or at least this line doesn't fix the error]
),0)))))
I've attached a zipped file of what I have so far. I had to zip it, as attaching an xlsx is apparently not supported.
If any of you kind gurus can please help me, I'd bestow upon you my fondest wishes!
Thank you so much,
Phillip
Attachments
Last edited: