I am about to take on a rather large excel project for our company. The first part is coming up with how to deal with our drafting department's length inputs. In this project, our users will be entering lengths in a unique format. I have to convert that unique format to a standard Foot-Inch-Fraction format.
To try to keep the file size down and keep the complexity down, i am looking for help converting a cell formula to VBA so i can run this on a group of cells rather than repeating my code downward multiple rows on multiple sheets.
It is either this or come up with my own font that will convert it for me but I do not know where to start with that. Anyone care to take a stab at converting this to a VB code i can run?
A3 = 1.0108
B3 = 1'-1 1/2"
The code in B3 looks like this:
![]()
=IF(A3=0,"",IF(A3="","",(TEXT(TRUNC((ROUNDDOWN(A3,0))),"0'-")&TEXT(((TRUNC(A3,2))-(ROUNDDOWN(A3,0)))*100,"0 ")&LOOKUP(MROUND((A3-(ROUNDDOWN(A3,0))-((TRUNC(A3,2))-(ROUNDDOWN(A3,0)))),0.0001),{0,0.0001,0.0002,0.0003,0.0004,0.0005,0.0006,0.0007,0.0008,0.0009,0.001,0.0011,0.0012,0.0013,0.0014,0.0015},{"","1/16""","1/8""","3/16""","1/4""","5/16""","3/8""","7/16""","1/2""","9/16""","5/8""","11/16""","3/4""","13/16""","7/8""","15/16"""}))))
An explanation of the unique format we use in our drafting department:
Basic Feet, Inch and Fraction format = 0 . 00 00 = Feet . Inch Fraction
The numbers left of the decimal point are feet. The first two numbers to the right of the decimal point are inches and the next two are sixteenths of an inch.
Examples:
4’-2" = 4.0200
15’-5 1/4" = 15.0504
4’-11 3/8" = 4.1106
0’-1 15/16" = 0.0115
Bookmarks