Convert Feet & Inches to Decimal Value

nickmarrcleveland

New Member
Joined
Mar 29, 2023
Messages
8
Office Version
  1. 365
Platform
  1. Windows
How do I convert a feet and inches value to a decimal value?
Ex: 5'-2 7/16" converted to 5.203125
My data does not have the same number of characters in each string.
Is there a formula or formulas that can be used for a data set with varying numbers of characters?

1715619375246.png
 
As state in my post "Convert Imperial to decimal inches", if want in decimal feet value just divide the result by 12 or
modifiy the line with:

Excel Formula:
...
si*(ft*12+VALUE(IF(ISERR(AND(FIND(" ",in),FIND("/",in))),IFERROR(VALUE("0 "&in),in),in))
)
to this:
Excel Formula:
...
(si*(ft*12+VALUE(IF(ISERR(AND(FIND(" ",in),FIND("/",in))),IFERROR(VALUE("0 "&in),in),in))))/12
)

Phh
 
Last edited:
Upvote 0

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
An improve version of LAMBDA function for convert Imperial feet-inches (in various formats)
to decimal value, with optional argument conversion factor [cFact].

or define "Excel Name" to hold conversion factor such as:

in=1 (default inch if not specify)
ft=1/12
yd=1/36
mi=1/63360 (mile)
mm=25.4
cm=2.54
m=0.0254
...
...
...

Excel Formula:
=LAMBDA(imperial, [cFact],
LET(si,IF(LEFT(imperial,1)="-",-1,1),
    ft,IFERROR(ABS(VALUE(LEFT(imperial,(FIND("'",imperial)-1)))),0),
    in,TRIM(SUBSTITUTE(SUBSTITUTE(IFERROR(RIGHT(imperial,LEN(imperial)-FIND("'",imperial)),imperial),"-",""),"""","")),
    si*(ft*12+VALUE(IF(ISERR(AND(FIND(" ",in),FIND("/",in))),IFERROR(VALUE("0 "&in),in),in)))/IF(ISOMITTED(cFact),1,1/cFact))
)

Some test
1717020392728.png


Phh
 
Upvote 0
It is possible that to convert from imperial feet-inches to decimal without using LAMBDA() and LET() functions with the older excel versions,
but the excel formula is ridiculous long and hard to read or trace error and it is impossible to have optional argument like convert to factor.

Experiment - Excel formula for convert imperial feet-inches to decimal inches
assuming cell A1 contains imperial feet-inches
Excel Formula:
=IF(LEFT(A1,1)="-",-1,1)*(IFERROR(ABS(VALUE(LEFT(A1,(FIND("'",A1)-1)))),0)*12+
VALUE(IF(ISERR(AND(FIND(" ",TRIM(SUBSTITUTE(SUBSTITUTE(IFERROR(RIGHT(A1,LEN(A1)-
FIND("'",A1)),A1),"-",""),"""",""))),FIND("/",TRIM(SUBSTITUTE(SUBSTITUTE(IFERROR(RIGHT(A1,LEN(A1)-
FIND("'",A1)),A1),"-",""),"""",""))))),IFERROR(VALUE("0 "&TRIM(SUBSTITUTE(SUBSTITUTE(IFERROR(RIGHT(A1,LEN(A1)-
FIND("'",A1)),A1),"-",""),"""",""))),
TRIM(SUBSTITUTE(SUBSTITUTE(IFERROR(RIGHT(A1,LEN(A1)-FIND("'",A1)),A1),"-",""),"""",""))),
TRIM(SUBSTITUTE(SUBSTITUTE(IFERROR(RIGHT(A1,LEN(A1)-FIND("'",A1)),A1),"-",""),"""","")))))
For convert to other decimal unit, multiply the result with the convert factor by adding to the very end or new line of the formula, for example:
To decimal feet
Excel Formula:
*(1/12)
To decimal yard
Excel Formula:
*(1/36)
To decimal mile
Excel Formula:
*(1/63306)
To milimeter
Excel Formula:
*(25.4)
To centimeter
Excel Formula:
*(2.54)
To meter
Excel Formula:
*(0.0254)

Phh
 
Upvote 0
An improve version of LAMBDA function for convert Imperial feet-inches (in various formats)
to decimal value, with optional argument conversion factor [cFact].

or define "Excel Name" to hold conversion factor such as:

in=1 (default inch if not specify)
ft=1/12
yd=1/36
mi=1/63360 (mile)
mm=25.4
cm=2.54
m=0.0254
...
...
...

Excel Formula:
=LAMBDA(imperial, [cFact],
LET(si,IF(LEFT(imperial,1)="-",-1,1),
    ft,IFERROR(ABS(VALUE(LEFT(imperial,(FIND("'",imperial)-1)))),0),
    in,TRIM(SUBSTITUTE(SUBSTITUTE(IFERROR(RIGHT(imperial,LEN(imperial)-FIND("'",imperial)),imperial),"-",""),"""","")),
    si*(ft*12+VALUE(IF(ISERR(AND(FIND(" ",in),FIND("/",in))),IFERROR(VALUE("0 "&in),in),in)))/IF(ISOMITTED(cFact),1,1/cFact))
)

Some test
View attachment 112061

Phh
I have come up with an alternate LAMBDA that produces the same results as your LAMBDA but is about 3/4 its size....
Excel Formula:
=LAMBDA(imperial,[cFact],
LET(tx,TRIM(SUBSTITUTE(imperial,"-"," ")),
sgn,IF(LEFT(imperial)="-","-",""),
ft,12*TEXTBEFORE(tx,"'",,,,0),
in,IFERROR(0+IF(ISNUMBER(-tx),tx,(TEXTAFTER(SUBSTITUTE(" 0 "&tx,"""",""),{"'"," "},-2,,,0))),),
0+(sgn&(ft+in))/IF(ISOMITTED(cFact),1,1/cFact)))(A11:A22)
 
Upvote 0
I have come up with an alternate LAMBDA that produces the same results as your LAMBDA but is about 3/4 its size....
Excel Formula:
=LAMBDA(imperial,[cFact],
LET(tx,TRIM(SUBSTITUTE(imperial,"-"," ")),
sgn,IF(LEFT(imperial)="-","-",""),
ft,12*TEXTBEFORE(tx,"'",,,,0),
in,IFERROR(0+IF(ISNUMBER(-tx),tx,(TEXTAFTER(SUBSTITUTE(" 0 "&tx,"""",""),{"'"," "},-2,,,0))),),
0+(sgn&(ft+in))/IF(ISOMITTED(cFact),1,1/cFact)))(A11:A22)

Thank you Rick, for your tips to shorten the formula

Phh
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,198
Members
452,617
Latest member
Narendra Babu D

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top