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
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Not quite clear. 5.203125 would be just over 5.2 in feet but that is 62.4375 in inches. What units do you want the decimal to represent? I'm asking to help someone else ID what you want out of a formula. I can usually do vba code but am mostly lost when it comes to formulas.
 
Upvote 0
Perhaps this.
Book1
AB
15'-2 7/16"5.203125
25'-11 7/8"5.989583
31'-2 11/16"1.223958
Sheet1
Cell Formulas
RangeFormula
B1:B3B1=LET(ts,IFERROR(--TEXTSPLIT(A1,,{"'","-"," ","/",""""}),0),inc,INDEX(ts,3)+INDEX(ts,4)/INDEX(ts,5),INDEX(ts,1)+inc/12)
 
Upvote 0
This works for the given values but not when a value is 0" and a fraction.

Ex 1' - 0 5/8"
Are there spaces before and after the hyphen? The above formula works when there are no spaces before and after the hyphen as provided example in the first post. If they do have spaces then this should work.
Book2
AB
15' - 2 7/16"5.203125
25' - 11 7/8"5.989583333
31' - 2 11/16"1.223958333
41' - 0 5/8"1.052083333
Sheet1
Cell Formulas
RangeFormula
B1:B4B1=LET(ts,IFERROR(--TEXTSPLIT(A1,,{"'"," - "," ","/",""""}),0),inc,INDEX(ts,3)+INDEX(ts,4)/INDEX(ts,5),INDEX(ts,1)+inc/12)
 
Upvote 0
Unlike convert from decimal to imperial feet-inch, which has only one format decimal to deal with. However when convert from imperial to decimal, think of how many imperial formats such as:

Ex:

10'-6"
10' - 6 1/2"
120"
120 3/8"
15/16"
15'
15.8333'
-1/4"
-21/64"
...
...
Etc...

To deal with, these really cumbersome! And depict all of above the hardest part is to prevent Excel from automatic converts fraction to date serial! Therefor I abandon it and work with excel VBA (dated back few year ago since excel 2010)
In recent Excel version, it is possible with these LAMBDA() & LET() functions

Convert Imperial to decimal inches
Excel Formula:
=LET(si,IF(LEFT(A1,1)="-",-1,1),
     ft,IFERROR(ABS(VALUE(LEFT(A1,(FIND("'",A1)-1)))),0),
     in,TRIM(SUBSTITUTE(SUBSTITUTE(IFERROR(RIGHT(A1,LEN(A1)-FIND("'",A1)),A1),"-",""),"""","")),
     si*(ft*12+VALUE(IF(ISERR(AND(FIND(" ",in),FIND("/",in))),IFERROR(VALUE("0 "&in),in),in)))
)

Or use with Lambda function
Excel Formula:
=LAMBDA(imperial,
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))))
)

Some test:
1716938294332.png



Let me know if there any error or I need to improve!

Give me thumb-up if you like!,

Phh
 
Upvote 0
According to post 3, the result should be in fractional feet? So 5' 2 - 7/16" should be converted to 5.203125 feet, not 62.4375 inches. That's how I interpret post 3 and that was the clarification I sought in post 2. If OP wants to consider a VBA solution I might be able to provide one, but given that there has been no activity on this for a while, I suspect it has been answered elsewhere.
 
Upvote 0
Give this formula a try...
Excel Formula:
=LET(t,TEXTSPLIT(A1,{"'",""""}),TAKE(t,,1)-CHOOSECOLS(t,2)/12)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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