I was asked by a colleague the other day for a custom function to convert millimeters into a readable format of feet and inches, for example 1000mm = 3 ft 3 5/16″, I didn’t know of such a function so I made it myself and here it is:
| Function Name: | ConvertMM | |
| Function Parameters: | MM | |
| Function Code | ||
| Let ( [ inches = MM * .03937008; feet = Floor ( inches/12 ); inches = Mod ( inches ;12 ); num = Floor(inches); sixteenths = Abs(Floor((inches - num) * 16)); ret = Case ( (Mod(sixteenths; 2) =1) ;num & " " & sixteenths & "/16" ; sixteenths = 2 or sixteenths = 6 or sixteenths = 10 or sixteenths = 14; num & " " & sixteenths / 2 & "/8" ; sixteenths = 4 or sixteenths = 12 ; num & " " & sixteenths / 4 & "/4" ; sixteenths = 8 ; num & " 1/2" ; num ) ]; feet & ” ft ” & ret & “\”" ) |
||
| Example Input: | 1000 | |
| Example Output: | 3 ft 3 5/16″ | |
| Example Usage: | $inches = ConvertMM(1000) |


