View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Alan Alan is offline
external usenet poster
 
Posts: 138
Default Is there a formula for length?


Bill wrote:
I work a lot with measurements mostly in inches, but I have found a need to
convert them to feet and inches quickly, is there a macro or formula to do
this?



Bill, copy this function into a macro module:

Public Function ConvertFeet(ByVal Inches As Double) As String

Dim Feet As Double

Feet = Int(Inches / 12)
ConvertFeet = Str(Feet) & "'" & Str(Inches - Feet * 12) & """"

End Function

You can then address the function whenever you want within your
spreadsheet. e.g. If cell A1 contains the value 108 (inches) and you
type =convertfeet(A1) into cell A2 it will return the answer 9' 0"