+ Reply to Thread
Results 1 to 5 of 5

Excel 2007 : Sorting column by numbers, lowest to highest

  1. #1
    Registered User
    Join Date
    06-06-2012
    Location
    San Diego, CA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Sorting column by numbers, lowest to highest

    Hello Forum,

    When I sort the data in a numbered cell from lowest to highest, I run into a problem. Numbers 2012-1 through 2012-10 are fine. However, the next number after 2012-10 is 2012-100 instead of 2012-11. Number 2012-11 does now show up until after number 2012-109. The next number following is number 2012-110.

    Example:

    2012-1
    2012-2
    2012-3
    2012-4
    2012-5
    2012-6
    2012-7
    2012-8
    2012-9
    2012-10
    2012-100
    2012-101
    The numbers are not stored as text.

    How can I get the numbers to sort from 1 to 500 sequentially?

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Sorting column by numbers, lowest to highest

    Click GO ADVANCED and use the paperclip icon to post up a copy of your workbook. We need to see what these really are.

    I'm going to guess you will need a helper column to "reformat" that data into strings that are all the same length:

    2012-1 >>>> 2012-001
    2012-101 >>> 2012-101


    You can see how Excel will have no problem sorting by the new format, then you can delete that helper column.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    06-06-2012
    Location
    San Diego, CA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Sorting column by numbers, lowest to highest

    Here is a sample of what i am speaking about. Due to security reasons, it is not a good idea to upload that actual file i am working on.
    Attached Files Attached Files

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Sorting column by numbers, lowest to highest

    1) Put this formula in C2, then copy it down the whole dataset:

    =LEFT(A2,4)&"-"&TEXT(MID(A2, FIND("-", A2)+1, 4),"000")

    2) Highlight columns A:C

    3) Sort those columns based on column C

    4) Clear the helper column C

  5. #5
    Registered User
    Join Date
    06-06-2012
    Location
    San Diego, CA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Sorting column by numbers, lowest to highest

    Brilliant!!! Thank you Jerry. You're awesome!!

+ 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