Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Fraction to decimal
I have a cell with a value of {0'-3/4}
I want another cell to call that value and change the format to {0'-0 3/4"} the following code will change it to a decimal when it is formatted correctly: which is what I am after. {=SUBSTITUTE(LEFT(H69,FIND("-",H69)-1),"'","")*12+SUBSTITUTE(REPLACE(H69,1,FIND("-",H69),""),"""","")} Thanks in advance Alvin Smith |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Fraction to decimal
You can add the text function to format the cell {=Text(SUBSTITUTE(LEFT(H69,FIND("-",H69)-1),"'","")*12+SUBSTITUTE(REPLACE(H69,1,FIND("-",H69),""),"""",""),ANYFORMAT)} the format would be in double quotes Like "General" or "0.00" -- joel ------------------------------------------------------------------------ joel's Profile: http://www.thecodecage.com/forumz/member.php?u=229 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=196484 http://www.thecodecage.com/forumz |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Fraction to decimal
"Alvin" wrote:
I have a cell with a value of {0'-3/4} I want another cell to call that value and change the format to {0'-0 3/4"} [so] the following code will change it to a decimal when it is formatted correctly: which is what I am after. If you would prefer, replace your original formula with the following, which handles all text of the form 1'-3/4", 1'-2 3/4" and 1'2": =12*LEFT(A1,FIND(CHAR(39),A1)-1) + (IF(ISNUMBER(FIND("/",A1)), IF(ISNUMBER(FIND(" ",A1)),"","0 "), "") & SUBSTITUTE(MID(A1,1+FIND("-",A1),99),CHAR(34),"")) You can replace CHAR(39) with "'" and CHAR(34) with """". I chose to use CHAR because the string forms are difficult to read in some fonts. Note: That is __not__ an array formula. Enter by simply pressing Enter, not ctrl+shift+Enter. You put curly braces around the formula in your original posting. I suspect that is your own meta-syntax to quote the formula. But Excel uses curly braces in that way to denote an array formula. So your intention is unclear. ----- original message ----- "Alvin" wrote: I have a cell with a value of {0'-3/4} I want another cell to call that value and change the format to {0'-0 3/4"} the following code will change it to a decimal when it is formatted correctly: which is what I am after. {=SUBSTITUTE(LEFT(H69,FIND("-",H69)-1),"'","")*12+SUBSTITUTE(REPLACE(H69,1,FIND("-",H69),""),"""","")} Thanks in advance Alvin Smith |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I turn a fraction into a decimal. | Excel Worksheet Functions | |||
How can I turn a fraction into a decimal. | Excel Worksheet Functions | |||
Convert fraction to decimal | Excel Discussion (Misc queries) | |||
leave the decimal fraction | Excel Worksheet Functions | |||
Help with decimal half fraction | Excel Programming |