+ Reply to Thread
Results 1 to 6 of 6

Text fraction conversion to decimal

Hybrid View

  1. #1
    Registered User
    Join Date
    01-17-2019
    Location
    Lincoln UK
    MS-Off Ver
    Office 2007
    Posts
    3

    Text fraction conversion to decimal

    Hello, I am having a problem converting text fractions (eg. 6¾) into a decimal figure which I can work with. When I use the substitute function, Excel inserts a zero straight after the whole number, so instead of 6¾ converting to 6.75 it comes up as 60.75.
    I have tried a few different ways to get it to work, but Excel is very flaky when it tries to deal with these text fractions and most often than not it gives a #VALUE error stating one of the elements is of the wrong data type.
    Using the IF, MATCH and OR functions to find the specific fractions and deal with them seemed to be the most logical way to go, but it simply won't do it.
    This is the function as I am using it:

    =1*SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"¼",0.25),"½",0.5),"¾",0.75)

    and I have attached a worksheet with examples.

    Any help would be most appreciated and will ensure the bald patches where I have torn out hair will grow back.
    Attached Files Attached Files

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,423

    Re: Text fraction conversion to decimal

    The SUBSTITUTE function returns (and deals with) text values, so change your formula to this:

    =1*SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"¼",".25"),"½",".5"),"¾",".75")

    then copy down. I've removed the leading zeros and treated the fractions as text values by putting them within quotes.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    01-17-2019
    Location
    Lincoln UK
    MS-Off Ver
    Office 2007
    Posts
    3

    Re: Text fraction conversion to decimal

    Thank you that man, although I originally tried that. Every time I delete the 0 and pressed return, Excel puts it back! It's still doing it now, but by making a cut and paste straight from here to the sheet made it work. What's that all about then ? I think some computers and software just play by their own rules sometimes

    Thank you again, Pete.

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Text fraction conversion to decimal

    Or try this
    Enter in B1 and copy down
    Formula: copy to clipboard
    =IFERROR(LOOKUP(10^99,--SUBSTITUTE(A1,{"½","¼","¾"},{0.5,0.25,0.75})),"")

    v A B
    1 1.00 1.00
    2 60.75
    3 20.75
    4 18.00 18.00
    5 10.25
    6 40.50
    7 11½ 110.50
    8 13½ 130.50
    9 1.00 1.00
    10 ¾ 0.75
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Text fraction conversion to decimal

    Or maybe this
    Formula: copy to clipboard
    =IFERROR(-LOOKUP(1,-SUBSTITUTE(A1,{"½","¼","¾"},{".5",".25",".75"})),"")

    v A B
    1 1.00 1.00
    2 6.75
    3 2.75
    4 18.00 18.00
    5 1.25
    6 4.50
    7 11½ 11.50
    8 13½ 13.50
    9 1.00 1.00
    10 ¾ 0.75

  6. #6
    Registered User
    Join Date
    01-17-2019
    Location
    Lincoln UK
    MS-Off Ver
    Office 2007
    Posts
    3

    Re: Text fraction conversion to decimal

    Thanks Al, that also works perfectly and elegant

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Problems converting fraction as a text cell to a decimal
    By KTENHAKEN in forum Excel General
    Replies: 4
    Last Post: 12-09-2019, 01:38 PM
  2. Fraction is read as decimal when text is combined in new cell
    By robclark63 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-30-2017, 11:24 PM
  3. Converting Decimal to Fraction Text VBA
    By vbalearnerSF in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-27-2014, 02:38 PM
  4. i need an replacing fraction to decimal conversion in vba excel
    By baig123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-10-2014, 06:04 AM
  5. Fraction conversion to mm with a twist
    By Rory Yates in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-27-2012, 11:08 AM
  6. Decimal to fraction conversion
    By Nunzio in forum Excel General
    Replies: 1
    Last Post: 10-16-2009, 12:45 PM
  7. How do I change a text fraction. eg 1 1/2 into a decimal number, .
    By antac in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-28-2005, 01:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1