+ Reply to Thread
Results 1 to 7 of 7

How do I sort a column consisting of fractions, decimals, and who.

  1. #1
    Split Window Diner
    Guest

    How do I sort a column consisting of fractions, decimals, and who.

    I need to sort products by the horsepower. Horsepower can be a fraction,
    decimal or whole number. For example, I need 1/100 to come before 1/10,
    1/125 to come before 1/12, 1/10 to come before 1.0, 3/4 to come before
    1...etc.

  2. #2
    Mexage
    Guest

    RE: How do I sort a column consisting of fractions, decimals, and who.

    Why don't you use the Fraction format under Number format?

    That way you only enter the decimal value and it will be represented by it's
    fraction, but the sorter won't be confused.

    Another option is to use this formula:

    =IF(ISERR(SEARCH("/",E8)),VALUE(E8),LEFT(E8,SEARCH("/",E8)-1)/RIGHT(E8,SEARCH("/",E8)-1))

    Where E8 is the value you need to convert from fraction or decimal to
    decimal. With this formula you can create another column next to the
    fractions, and you can sort by it's decimal values...

    E F
    8 '1/2 .5
    9 '1/3 .33333
    10 '1/30 .0333333

    F8 would contain the formula I wrote, and you sort the entire table by
    column F.

    Hope that helps and if it does please vote for this answer.

    G.Morales

    "Split Window Diner" wrote:

    > I need to sort products by the horsepower. Horsepower can be a fraction,
    > decimal or whole number. For example, I need 1/100 to come before 1/10,
    > 1/125 to come before 1/12, 1/10 to come before 1.0, 3/4 to come before
    > 1...etc.


  3. #3
    Splt Window Diner
    Guest

    RE: How do I sort a column consisting of fractions, decimals, and



    "Mexage" wrote:

    > Why don't you use the Fraction format under Number format?
    >
    > That way you only enter the decimal value and it will be represented by it's
    > fraction, but the sorter won't be confused.
    >
    > Another option is to use this formula:
    >
    > =IF(ISERR(SEARCH("/",E8)),VALUE(E8),LEFT(E8,SEARCH("/",E8)-1)/RIGHT(E8,SEARCH("/",E8)-1))
    >
    > Where E8 is the value you need to convert from fraction or decimal to
    > decimal. With this formula you can create another column next to the
    > fractions, and you can sort by it's decimal values...
    >
    > E F
    > 8 '1/2 .5
    > 9 '1/3 .33333
    > 10 '1/30 .0333333
    >
    > F8 would contain the formula I wrote, and you sort the entire table by
    > column F.
    >
    > Hope that helps and if it does please vote for this answer.
    >
    > G.Morales
    >
    > "Split Window Diner" wrote:
    >
    > > I need to sort products by the horsepower. Horsepower can be a fraction,
    > > decimal or whole number. For example, I need 1/100 to come before 1/10,
    > > 1/125 to come before 1/12, 1/10 to come before 1.0, 3/4 to come before
    > > 1...etc.

    This did not work on all of the values in the column. Some fractions did
    not convert to decimal correctly and some did.

  4. #4
    Dave Peterson
    Guest

    Re: How do I sort a column consisting of fractions, decimals, and

    What were the fractions that didn't convert?
    And what did the formula return for those?


    Splt Window Diner wrote:
    >
    > "Mexage" wrote:
    >
    > > Why don't you use the Fraction format under Number format?
    > >
    > > That way you only enter the decimal value and it will be represented by it's
    > > fraction, but the sorter won't be confused.
    > >
    > > Another option is to use this formula:
    > >
    > > =IF(ISERR(SEARCH("/",E8)),VALUE(E8),LEFT(E8,SEARCH("/",E8)-1)/RIGHT(E8,SEARCH("/",E8)-1))
    > >
    > > Where E8 is the value you need to convert from fraction or decimal to
    > > decimal. With this formula you can create another column next to the
    > > fractions, and you can sort by it's decimal values...
    > >
    > > E F
    > > 8 '1/2 .5
    > > 9 '1/3 .33333
    > > 10 '1/30 .0333333
    > >
    > > F8 would contain the formula I wrote, and you sort the entire table by
    > > column F.
    > >
    > > Hope that helps and if it does please vote for this answer.
    > >
    > > G.Morales
    > >
    > > "Split Window Diner" wrote:
    > >
    > > > I need to sort products by the horsepower. Horsepower can be a fraction,
    > > > decimal or whole number. For example, I need 1/100 to come before 1/10,
    > > > 1/125 to come before 1/12, 1/10 to come before 1.0, 3/4 to come before
    > > > 1...etc.

    > This did not work on all of the values in the column. Some fractions did
    > not convert to decimal correctly and some did.


    --

    Dave Peterson

  5. #5
    Mexage
    Guest

    Re: How do I sort a column consisting of fractions, decimals, and

    Perhaps values like 1 1/2
    in which case you would be better off using a macro.

    Ok... here it goes without macros:

    =IF(ISERR(SEARCH("/",A1)),VALUE(A1),IF(ISERR(SEARCH("
    ",TRIM(A1))),LEFT(A1,SEARCH("/",A1)-1)/MID(A1,SEARCH("/",A1)+1,10),VALUE(LEFT(A1,SEARCH("
    ",TRIM(A1))))+MID(A1,SEARCH(" ",TRIM(A1)),SEARCH("/",A1)-SEARCH("
    ",TRIM(A1)))/MID(A1,SEARCH("/",A1)+1,10)))

    I know it's ugly, but it will take in numbers such as '1 1/3
    Please only use one space between the fraction and the integer.

    Hope that helps
    if it does, please vote for this post

    G.Morales
    "Dave Peterson" wrote:

    > What were the fractions that didn't convert?
    > And what did the formula return for those?
    >
    >
    > Splt Window Diner wrote:
    > >
    > > "Mexage" wrote:
    > >
    > > > Why don't you use the Fraction format under Number format?
    > > >
    > > > That way you only enter the decimal value and it will be represented by it's
    > > > fraction, but the sorter won't be confused.
    > > >
    > > > Another option is to use this formula:
    > > >
    > > > =IF(ISERR(SEARCH("/",E8)),VALUE(E8),LEFT(E8,SEARCH("/",E8)-1)/RIGHT(E8,SEARCH("/",E8)-1))
    > > >
    > > > Where E8 is the value you need to convert from fraction or decimal to
    > > > decimal. With this formula you can create another column next to the
    > > > fractions, and you can sort by it's decimal values...
    > > >
    > > > E F
    > > > 8 '1/2 .5
    > > > 9 '1/3 .33333
    > > > 10 '1/30 .0333333
    > > >
    > > > F8 would contain the formula I wrote, and you sort the entire table by
    > > > column F.
    > > >
    > > > Hope that helps and if it does please vote for this answer.
    > > >
    > > > G.Morales
    > > >
    > > > "Split Window Diner" wrote:
    > > >
    > > > > I need to sort products by the horsepower. Horsepower can be a fraction,
    > > > > decimal or whole number. For example, I need 1/100 to come before 1/10,
    > > > > 1/125 to come before 1/12, 1/10 to come before 1.0, 3/4 to come before
    > > > > 1...etc.

    > > This did not work on all of the values in the column. Some fractions did
    > > not convert to decimal correctly and some did.

    >
    > --
    >
    > Dave Peterson
    >


  6. #6
    Forum Contributor
    Join Date
    01-11-2004
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    388
    Hi!

    I get the feeling your "numbers" for Horsepower are entered as text.

    If they were true numbers, they would respond to sorting.

    You can usually convert text to number (use a helper column if you like) by either adding zero to them all or multiplying them all by 1. To do this, use copy and then paste special using operation add or multiply.

    Alf

  7. #7
    Registered User
    Join Date
    07-06-2013
    Location
    northeast
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: How do I sort a column consisting of fractions, decimals, and

    Quote Originally Posted by Mexage View Post
    Perhaps values like 1 1/2
    in which case you would be better off using a macro.

    Ok... here it goes without macros:

    =IF(ISERR(SEARCH("/",A1)),VALUE(A1),IF(ISERR(SEARCH("
    ",TRIM(A1))),LEFT(A1,SEARCH("/",A1)-1)/MID(A1,SEARCH("/",A1)+1,10),VALUE(LEFT(A1,SEARCH("
    ",TRIM(A1))))+MID(A1,SEARCH(" ",TRIM(A1)),SEARCH("/",A1)-SEARCH("
    ",TRIM(A1)))/MID(A1,SEARCH("/",A1)+1,10)))

    I know it's ugly, but it will take in numbers such as '1 1/3
    Please only use one space between the fraction and the integer.

    Hope that helps
    if it does, please vote for this post

    G.Morales
    [/color]
    Worked grand that man, just the jobbie - thanks a lot you're a life saver!

    -Tom

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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