Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
2 cells. One for feet(A1), one for inches(A2). A3=(A1+(A2/12))
-Ok lets do the samething again. 2 more cells. One for feet(B1), one for inches(B2). B3=(B1+(B2/12)) -One more time 2 more cells. One for feet(C1), one for inches(C2). C3=(C1+(C2/12)) -Finally D3=((A3+B3)-C3) Now as far as I can tell everything works just fine. But I have a macro to convert a decimal number into Feet and Inches: Public Function LenText(FeetIn As Double) Denominator = 32 NbrFeet = Fix(FeetIn) InchIn = (FeetIn - NbrFeet) * 12 NbrInches = Fix(InchIn) FracIn = (InchIn - NbrInches) * Denominator Numerator = Application.WorksheetFunction.Round(FracIn, 0) If Numerator = 0 Then FracText = "" ElseIf Numerator = Denominator Then NbrInches = NbrInches + 1 FracText = "" Else Do If Numerator = Application.WorksheetFunction.Even(Numerator) Then Numerator = Numerator / 2 Denominator = Denominator / 2 Else FracText = " " & Numerator & "/" & Denominator Exit Do End If Loop End If LenText = NbrFeet & "' " & NbrInches & FracText & """" End Function Try; A1 = 865 A2 = 2 B1 = 0 B2 = 6.5 C1 = 0 C2 = 8.5 If done correctly D3 will return 865. If the run the LenText marco on this cell it returns 864' 12". If you type 865 in a blank cell and run the LenText macro against it, it returns 865' 0". What gives? This doesn't make any sence to me. Is the Macro corrupt or is it something wrong with decimal places? I realize this is a lot to process, but any help would be very useful. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Is there a formula for inches to feet and inches? | Excel Worksheet Functions | |||
feet, inches | Excel Worksheet Functions | |||
feet and inches | Excel Worksheet Functions | |||
is there a macro that will convert from inches to feet and inches | Excel Discussion (Misc queries) | |||
Converting inches to feet & inches. | Excel Worksheet Functions |