+ Reply to Thread
Results 1 to 3 of 3

Convert Fraction (Text Value) to Decimal (Numeric Value)?

  1. #1
    Forum Contributor
    Join Date
    03-26-2015
    Location
    Cookeville, TN
    MS-Off Ver
    Excel 365
    Posts
    221

    Convert Fraction (Text Value) to Decimal (Numeric Value)?

    This should (I'd think) be simple, but I can't figure it out.
    I have Width (a text variable) that can contain a fraction (such as "2 1/2"). I need to set a WidthDim variable (double) equal to the value indicated by Width.
    I tried:
    Please Login or Register  to view this content.
    but this gives me a Type Mismatch error.
    I tried splitting Width into two strings (one for the integer portion, and one for the fraction), but that doesn't work either. If I try:
    Please Login or Register  to view this content.
    in the Immediate window, I still get a type mismatch error.

    So how can I convert a text string (such as "1/2" or "7/16") into a decimal value??

  2. #2
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2024
    Posts
    6,180

    Re: Convert Fraction (Text Value) to Decimal (Numeric Value)?

    Debug.Print Evaluate("2 1/2")

    Debug.Print Evaluate("7/6")

  3. #3
    Forum Contributor
    Join Date
    03-26-2015
    Location
    Cookeville, TN
    MS-Off Ver
    Excel 365
    Posts
    221

    Re: Convert Fraction (Text Value) to Decimal (Numeric Value)?

    Thanks! That solved it. In VBA code I will use Application.Evaluate.

+ 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. [SOLVED] Convert fraction to decimal
    By sur4j in forum Excel General
    Replies: 10
    Last Post: 12-09-2019, 01:39 PM
  2. [SOLVED] Convert this fraction 9' 3 1/4" and others like it to a decimal
    By LonnieLSmith in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-23-2019, 11:39 AM
  3. Decimal convert into fraction
    By KTM450 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-19-2015, 01:06 PM
  4. Replies: 9
    Last Post: 12-19-2014, 07:29 PM
  5. Replies: 10
    Last Post: 06-11-2013, 06:11 PM
  6. Convert fraction to a decimal
    By Dillons Grandpa in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 02-24-2013, 12:49 PM
  7. convert decimal to inch & fraction
    By davepatrob in forum Excel General
    Replies: 1
    Last Post: 12-31-2005, 01:10 AM

Tags for this Thread

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