+ Reply to Thread
Results 1 to 3 of 3

sorting alphanumeric

  1. #1
    Chronos
    Guest

    sorting alphanumeric

    hello, I hope this problem I am having can be simply solved....

    I need to sort all in one column the following sequence ( I use it for
    managing keys that are made. Subsequent keys are enumerated by adding the
    next sequential letter)
    ex: 101, 102,102a,102b,103
    Current any sort I use sorts it this way :101, 102, 103, 102a, 102b

    What can I do to sort chronologically with the letters in the same column so
    the result looks like this:
    101, 102,102a,102b,103

    If I add a key to 101, it needs to sort this way:
    101,101a,102,102a,102b,103

    can any one help, thank you

  2. #2
    Forum Contributor
    Join Date
    04-11-2005
    Location
    London
    Posts
    259
    Assuming your data is in column A, AND assuming that all data is of the format 3 numbers+1 letter,

    in column B type:

    =LEFT(A1,3)
    =LEFT(A2,3)
    =LEFT(A3,3)

    and so on.

    Now sort your grid from the menu option first by column B ascending then by column A ascending. This will do it.
    Last edited by MartinShort; 05-17-2005 at 05:01 AM.
    Martin Short

  3. #3
    Héctor Miguel
    Guest

    Re: sorting alphanumeric

    hi, Chronos !

    > ... I hope this problem... can be simply solved...
    > I need to sort all in one column the following sequence... ex: 101, 102,102a,102b,103
    > Current any sort I use sorts it this way :101, 102, 103, 102a, 102b
    > ... to sort chronologically with the letters in the same column so the result looks like this:
    > 101, 102,102a,102b,103
    > If I add a key to 101, it needs to sort this way: 101,101a,102,102a,102b,103


    one -possible- way and if it's ok for you to 'have to' use a 'helper' column...
    assuming first key in [b2], sort by a column with a formula like the following:
    =sumproduct(value(code(mid(b2,choose(1+(len(b2)=4),{1;2;3},{1;2;3;4}),1))&rept("0",choose(1+(len(b2)=4),{7;5;3},{7;5;3;0}))))

    if you are planing to generate keys including letters for the first 3 characters...
    you might have to change the 'zero' array from: 7;5;3 to: 10;7;4

    hth,
    hector.



+ 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