Using Excel Macros:
I am trying to create a function that takes a double called Feet and another called Inches and have it return the total number of inches. That is the easy part. I want it to then display the information in the cell like so:
5ft 8in
Here is the code that I have come up with:
Function FTIN(Feet As Double, Inches As Double) As Double
'This part works fine.
Dim total As Double
total = (Feet * 12) + Inches
FTIN = total
'this part does not seem to work.
Dim foot As Double
Dim inch As Double
foot = WorksheetFunction.RoundDown(total / 12, 0)
inch = total - (foot * 12)
result = foot & "ft " & inch & "in"
End Function
while it does return the the total number of inches it does not display it in the way I need it to.
I basically want it to do the same thing as dates where the value is 41361 but what is displayed is "3/28/2013".
Also I know I can make the value as 508 and I can make the custom format as 0"ft "00"in", but that would not give me a value that I can work with.
Please help me with this.