decimals to feet and inches with excel 2002

anon125

Active Member
Joined
Feb 14, 2008
Messages
392
=B1&"' "&TEXT(C1,"0 #/##")&CHAR(34)
34.6 leads to

<tbody>
[TD="class: xl24"]34' 6 49/71"[/TD]

</tbody>
thanks all

i have forgotten how to post the spreadsheet
 
Last edited:

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Or =B1 & TEXT(C1,"' 0 #/##""")

Is there a question?
 
Upvote 0
Thanks
in 2002 it says VALUE
OkI4BFgl.png
 
Upvote 0
Here is a UDF (user defined function) that you can consider. It rounds fractions to the nearest 64th of an inch (can be changed via the optional second argument if desired).
Code:
[table="width: 500"]
[tr]
	[td]Function FeetInches(ByVal DecimalFeet As Variant, Optional ByVal LargestDenominator As Long = 64) As String
  Dim GCD As Long
  Dim TopNumber As Long
  Dim Remainder As Long
  Dim Feet As Long
  Dim Numerator As Long
  Dim Denominator As Long
  Dim Inches As Double
  DecimalFeet = CDbl(DecimalFeet)
  Feet = Int(DecimalFeet)
  Inches = 12 * (DecimalFeet - Feet)
  Denominator = LargestDenominator
  Numerator = Format(Denominator * Abs(Inches - Int(Inches)), "0")
  If Numerator Then
    GCD = LargestDenominator
    TopNumber = Numerator
    Do
      Remainder = (GCD Mod TopNumber)
      GCD = TopNumber
      TopNumber = Remainder
    Loop Until Remainder = 0
    Numerator = Numerator \ GCD
    Denominator = Denominator \ GCD
    FeetInches = CStr(Feet) & "' " & Int(Inches) & "-" & CStr(Numerator) & "/" & CStr(Denominator) & """"
  End If
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 FeetInches just like it was a built-in Excel function. For example,

=FeetInches 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.
 
Upvote 0
Thanks Rick
i would rather keep it simple!
I understand that, but if the formula 'shg' gave you does not work in your version of Excel, you may not have any other choice (which is why I posted the UDF for you to consider).
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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