jerry1423
Mechanical
- Aug 19, 2005
- 3,428
Does anybody know if it is possible to covert meters to feet-fractional inches in excel?
I could not find anything on this.
Thanks
I could not find anything on this.
Thanks
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Function M2Ftin(Mval As Double, Optional Denom As Long = 0, Optional InDP As Long = 2) As String
Dim ft As Double, inch1 As Double, inch2 As Double, Frac As Long, m2in As Double, Rtn As String
'Converts MVal to ft and inches, returning a string
'If Denom is > 0 then inches are returned as a fraction with the specified denominator
' If Denom is zero or blank inches are returned as a decimal with InDP decimal places, default 2
m2in = 1000 / 25.4
inch1 = Mval * m2in
ft = Int(inch1 / 12)
inch2 = inch1 - ft * 12
ft = Int(inch1 / 12)
If Denom > 0 Then
Frac = Round((inch2 - Int(inch2)) * Denom, 0)
inch2 = Int(inch2)
Else
inch2 = Round(inch2, InDP)
End If
Rtn = ft & "' " & inch2
If Denom > 0 Then
If Frac > 0 Then
Rtn = Rtn & " " & Frac & "/" & Denom & """"
Else
Rtn = Rtn & """"
End If
Else
Rtn = Rtn & """"
End If
M2Ftin = Rtn
End Function