ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   fractions to decimal (https://www.excelbanter.com/excel-programming/441768-fractions-decimal.html)

Alvin

fractions to decimal
 
I want to have one cell call a cell that has a fraction in it that is
formated like so
0'-7/8"
I need it to be formated like
0'-0 7/8" so with the following code I can convert it to decimal.

[=SUBSTITUTE(LEFT(H69,FIND("-",H69)-1),"'","")*12+SUBSTITUTE(REPLACE(H69,1,FIND("-",H69),""),"""","")]

the above code works when it is formated correctly

Please help
Thanks in advance

ker_01

fractions to decimal
 
Is this a custom cell format, or just content stored as the text default?

if text, why not just search/replace "-" with "- 0 "

Or if you have mixed cells (you didn't provide much detail), use code to
find cells where [logic, not code] =Len
((find("/",string))-(find("-",string)))< 3
and just replace in those cells

HTH
Keith


"Alvin" wrote:

I want to have one cell call a cell that has a fraction in it that is
formated like so
0'-7/8"
I need it to be formated like
0'-0 7/8" so with the following code I can convert it to decimal.

[=SUBSTITUTE(LEFT(H69,FIND("-",H69)-1),"'","")*12+SUBSTITUTE(REPLACE(H69,1,FIND("-",H69),""),"""","")]

the above code works when it is formated correctly

Please help
Thanks in advance



All times are GMT +1. The time now is 09:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com