VBA: Converting Ft. to decimal

bamaisgreat

Well-known Member
Joined
Jan 23, 2012
Messages
826
Office Version
  1. 365
Platform
  1. Windows
Thanks for Looking. I am trying to come up with a way to convert a column of Fractions to a column of decimal. I have tried just formatting the cells but it doesn't seem to look the way I need it. Example: If I enter 6-11 3/8 I need it to show up in the other column as 83.375
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
This formula seems to work...

=IF(A1="","",12*LEFT(A1,FIND("-",A1&"-")-1)+IF(COUNTIF(A1,"*-*"),MID(A1,FIND("-",A1)+1,2),0)+IF(COUNTIF(A1,"* */*"),MID(LEFT(A1,FIND("/",A1)-1),FIND(" ",A1)+1,9)/MID(A1,FIND("/",A1)+1,9),0))
 
Upvote 0
This formula seems to work...

=IF(A1="","",12*LEFT(A1,FIND("-",A1&"-")-1)+IF(COUNTIF(A1,"*-*"),MID(A1,FIND("-",A1)+1,2),0)+IF(COUNTIF(A1,"* */*"),MID(LEFT(A1,FIND("/",A1)-1),FIND(" ",A1)+1,9)/MID(A1,FIND("/",A1)+1,9),0))

Thanks Rick, Worked Great
 
Upvote 0
Also, you may give this formula a try:

=CONVERT(LEFT(A1,MIN(FIND({"-"," "},A1&"- "))-1),"ft","in")+IFERROR(CONVERT(RIGHT(A1,LEN(A1)-FIND({"-"," "},A1&"- ")),"in","in"),0)
 
Upvote 0
Also, you may give this formula a try:

=CONVERT(LEFT(A1,MIN(FIND({"-"," "},A1&"- "))-1),"ft","in")+IFERROR(CONVERT(RIGHT(A1,LEN(A1)-FIND({"-"," "},A1&"- ")),"in","in"),0)

I like István's use of the CONVERT function in the second part of his formula, but I would point out his use of the IFERROR function restricts his formula to being used on XL2007 or later (my formula work for XL2003 and probably earlier versions as well... I don't have earlier versions to test it on). I would eliminate the first CONVERT function call though and go with a simple multiplication by 12...

=12*LEFT(A1,MIN(FIND({"-"," "},A1&"- "))-1)+IFERROR(CONVERT(RIGHT(A1,LEN(A1)-FIND({"-"," "},A1&"- ")),"in","in"),0)
 
Upvote 0

Forum statistics

Threads
1,215,664
Messages
6,126,101
Members
449,292
Latest member
Mario BR

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top