Converting Fractional inches and feet-inches to decimal inches

Nanaia

Active Member
Joined
Jan 11, 2018
Messages
304
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I've scoured the archives looking for a way to convert fractional inches or feet-inches into decimal inches and couldn't find a solution. I have column CO looking at column CN as a reference to convert the entry from inches or feet-inches (the data varies) to decimal inches and can't get it to work. I've tried CONVERT(CN3,"ft","in") which works fine if there is a foot value involved but not if the value is fractional inches. Do you have any recommendations?
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
I've tried CONVERT(CN3,"ft","in") which works fine if there is a foot value involved but not if the value is fractional inches. Do you have any recommendations?

seems to work for me?
if i have your formula in CO3

CNCO
1 5/720 4/7

<tbody>
</tbody>


and then you right click > format as number with .00 decimal

CNCO
1 5/720.57

<tbody>
</tbody>

you can format the other way around as well
 
Last edited:
Upvote 0
I seem to have worded things poorly. (Gotta love Excel...) Column CO is looking at column CN and converting the data contained in CN. CN is pulling the data from another sheet that includes the ' for foot and the " for inches and changing the formatting of the column has no affect.
 
Upvote 0
I seem to have worded things poorly. (Gotta love Excel...) Column CO is looking at column CN and converting the data contained in CN. CN is pulling the data from another sheet that includes the ' for foot and the " for inches and changing the formatting of the column has no affect.

AH i understand now
want to give me the 2 sheet names, the formula in cn, and any example numbers/numbers?
I prefer to work with what you are working with if possible
 
Upvote 0
A​
B​
C​
1​
ft & in
dec in
2​
10' 2 3/4"
122.75​
B2: =IFERROR(LEFT(A2, FIND("'", A2) - 1), 0) * 12 + SUBSTITUTE(IFERROR(MID(A2, FIND("'", A2) + 1, 8), A2), """", "")
3​
1' 0 63/64"
12.984375​
4​
1 1/2"
1.5​
 
Upvote 0
The only column I'm concerned with is CO. CN can contain a wide variety of information (it changes with each line and job). I only want to have CO look at CN and give me a decimal number. The trouble I'm running into is that CO can be 10", 10 1/2", 1'-9", 7'-4", etc. because it varies. I want CO to look at a number like 7'-4" and convert it to 88.000 and look at 10 1/2" and convert it to 10.000.
 
Upvote 0
Here is a UDF (user defined function) which, assuming fractions are offset with a space or dash only, should be able to handle almost thing you throw at it (see below for some samples)...
Code:
[table="width: 500"]
[tr]
	[td]Function Inches(ByVal FeetInch As String) As Variant
  Dim FootMark As Long, Foot As String, Inch As String, Temp As Variant
  FeetInch = Application.Trim(Replace(Replace(Replace(Application.Trim(FeetInch), "-", " "), "/ ", "/"), " /", "/"))
  FootMark = InStr(FeetInch, "'")
  If FootMark Then
    Foot = Split(FeetInch, "'")(0)
    Inch = Replace(Split(FeetInch, "'")(1), """", "")
  Else
    Inch = Trim(Replace(FeetInch, """", ""))
  End If
  If InStr(Foot, " ") Then
    Temp = Split(Application.Trim(Foot))
    Foot = (Temp(0) + Evaluate(Temp(1)))
  End If
  If InStr(Inch, " ") Then
    Temp = Split(Trim(Inch) & " ")
    Inch = (Temp(0) + Evaluate(Temp(1)))
  End If
  Inches = 12 * Val(Foot) + Val(Inch)
End Function[/td]
[/tr]
[/table]

HOW TO INSTALL UDFs
------------------------------------
If you are new to UDFs, they are easy to install and use. To install it, simply press ALT+F11 to go into the VB editor and, once there, click Insert/Module on its menu bar, then copy/paste the above code into the code window that just opened up. That's it.... you are done. You can now use Inches just like it was a built-in Excel function. For example,

=Inches(A1)

If you are using XL2007 or above, make sure you save your file as an "Excel Macro-Enabled Workbook (*.xlsm) and answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.


Sample Values That Function Can Handle
------------------------------------------------------------
Code:
10' 2-3/4"
1' 0 63/64"
    1   -    1    /     2    "
1 3/4'
3'
3 "
1 - 2 / 3 '    3 - 1 / 2 "
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,560
Messages
6,120,217
Members
448,951
Latest member
jennlynn

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