+ Reply to Thread
Results 1 to 7 of 7

Sorting mixed numeric values

  1. #1
    Registered User
    Join Date
    05-30-2012
    Location
    Louisville, KY
    MS-Off Ver
    Excel 2010
    Posts
    10

    Sorting mixed numeric values

    I searched on google for this and found a number of answers but am either not excel smart or am doing something wrong.

    I need to sort a series of values in numeric order including suffixes. The numbers have a variety of formatting (supplied by the client ) relating to a series of standard documents they provide. There are close to 200 values and will more than likely change several times over the course of the project, otherwise I would just enter it manually...

    example numbers:

    1
    2
    15
    115a
    114a.1
    81
    114.1

    in theory they should sort:

    1
    2
    15
    81
    114a.1
    114.1
    115a

    I've tried using =""&A1 as well as =Text(A1,"000000") in a seperate column and am still getting nowhere with it. Cells have been formatted as numbers, text and general. FWIW - I tried on a small, arbitrary range of 3 digit values with a suffix and couldn't get that to work either so I'm assuming a fair bit of user error.

    thanks

  2. #2
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Sorting mixed numeric values

    See this thread from earlier today: http://www.excelforum.com/excel-2007...16#post2806216

    Change one step for your scenario. When the Sort Warning pops up choose the first option.

  3. #3
    Registered User
    Join Date
    05-30-2012
    Location
    Louisville, KY
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Sorting mixed numeric values

    Still no luck =/ It sorted numbers, then letters and is still putting values in the wrong order. Again - I'll assume user error since I can get almost there.

    After sorting I'm getting the following:

    161
    800
    114a
    114a.1
    14m
    150m
    150s
    15a

    14m and 15a should be well before any of those values.

    If I pick the second option in the sort warning it sorts almost correctly. Everything is in the correct order by the first digit, however 2 ends up 20 spots down the list after everything with a 1 in front:

    12
    114a
    114a.1
    115
    2

  4. #4
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Sorting mixed numeric values

    Yes, it worked on your first sample but not your second one. I'll take a closer look.

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Sorting mixed numeric values

    best i can get it is
    1
    2
    15
    115a
    114a.1
    81
    114.1
    12
    161
    to sort as
    1
    2
    12
    15
    81
    114.1
    114a.1
    115a
    161



    using as helper =IF(ISNUMBER(A1+0),TEXT(A1+0,"0000000"),"0000"&SUBSTITUTE(A1,".",""))
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  6. #6
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Sorting mixed numeric values

    EDIT: I was going to suggest VBA but I see MDW has offered a solution.

  7. #7
    Registered User
    Join Date
    05-30-2012
    Location
    Louisville, KY
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Sorting mixed numeric values

    Quote Originally Posted by Cutter View Post
    Yes, it worked on your first sample but not your second one. I'll take a closer look.
    Sorry about that. I didn't realize it would make a difference =/

    MDW: Thanks - I'm about to be late for a meeting but I'll give it a go this afternoon. I do have one question - could you translate all that and explain what the functions mean? I try to learn this stuff when I can but it honestly is like a foreign language to me

+ 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