+ Reply to Thread
Results 1 to 5 of 5

Sorting issue

  1. #1
    Registered User
    Join Date
    09-01-2009
    Location
    England
    MS-Off Ver
    Excel 2000
    Posts
    25

    Thumbs up Sorting issue

    I am trying to sort a column of data in ascending order but I am not getting the results I expect. An example of the data held in the cells is:

    4972-1A
    4972-10A
    4972-2A
    4972-1B
    4972-3C

    When I sort it in ascending order it sorts like:
    4972-10A
    4972-1A
    4972-1B
    4972-2A
    4972-3C

    I want it to sort as:
    4972-1A, 1B, ...
    4972-2A, 2B, ...
    4972-3A, 3B,...
    through to
    4972-10A, 10B...
    and so on...

    Any help on how to sort it in the order that I want would be great.
    Last edited by floribunda; 09-02-2009 at 08:28 AM.

  2. #2
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Valrico, FL USA
    MS-Off Ver
    Excel 2016
    Posts
    358

    Re: Sorting issue

    Adding a zero would help.

    4972-01A
    4972-10A
    4972-02A

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Sorting issue

    That is an excellent route though worth nothing that the number of zeroes to be added shall be determined by the max number that appears post hyphen in your data set
    (ie if >=100 and < 1000 then you would need 000 format, >=1000 and < 10000 it would be 0000 etc...)

  4. #4
    Forum Contributor
    Join Date
    08-11-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    149

    Re: Sorting issue

    If the values always have the same number digits before the hyphen and at least 2 characters after the hyphen, you could use the following formula to in an adjacent column to "fix" your data:
    =LEFT(A1,5)&TEXT(LEFT(RIGHT(A1,LEN(A1)-5),LEN(A1)-6),"00000")&RIGHT(A1,1)

  5. #5
    Registered User
    Join Date
    09-01-2009
    Location
    England
    MS-Off Ver
    Excel 2000
    Posts
    25

    Thumbs up Re: Sorting issue

    Thanks for the help and the alternative options. I have gone for the solution suggested by Masteff as this suits how the data is added into the spreadsheet in the first place. Many thanks!

+ 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