+ Reply to Thread
Results 1 to 6 of 6

Unusual Custom Cell Format Needed to Correctly Sort Values

  1. #1
    Registered User
    Join Date
    08-18-2010
    Location
    Santa Cruz CA
    MS-Off Ver
    2003, 2007, 2010
    Posts
    5

    Unusual Custom Cell Format Needed to Correctly Sort Values

    Hi,

    I have a spreadsheet that contains a column with values. These values can be alphanumeric, but often just have numbers. Also, some have leading zeros. An example of the column would be:

    080
    080A
    085V
    086
    128
    119
    119C
    016
    143D
    143B
    144

    I want it to sort first numerically and then alphabetically, and I need to keep the leading zeros present. I've tried it set as text, but the results are inconsistent. For instance 080 will show up before 016. Setting it to just be a number drops the leading zeros. I know how to maintain the zeros through custom formatting, but the list still does not sort correctly.

    Any advice on what custom format would correct this would be great, as would pointers to anything else I should be looking at.

    Thanks very much for your time, and please let me know if you have any questions.
    Last edited by momus44; 08-18-2010 at 07:14 PM.

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

    Re: Unusual Custom Cell Format Needed to Correctly Sort Values

    given your example what would the final sort look like? post a workbook with some real examples!
    Last edited by martindwilson; 08-18-2010 at 05:05 PM.
    "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

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Unusual Custom Cell Format Needed to Correctly Sort Values

    Formatting does not affect the underlying cell values, and so does not affect the sort order.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    08-18-2010
    Location
    Santa Cruz CA
    MS-Off Ver
    2003, 2007, 2010
    Posts
    5

    Re: Unusual Custom Cell Format Needed to Correctly Sort Values

    Ok, I've attached a workbook with the values I outlined above. The desired sort results would look like:

    016
    080
    080A
    085V
    086
    119
    119C
    128
    143B
    143D
    144

    Essentially sorting on the numeric value first then the alpha value, though the numeric value is the most important.

    Thanks.
    Attached Files Attached Files

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Unusual Custom Cell Format Needed to Correctly Sort Values

    In your example, in B1 and copy down,

    =A1 & ""

    ... then sort the ensemble by col B. When prompted, tick the option to Sort numbers and numbers stored as text separately

  6. #6
    Registered User
    Join Date
    08-18-2010
    Location
    Santa Cruz CA
    MS-Off Ver
    2003, 2007, 2010
    Posts
    5

    Re: Unusual Custom Cell Format Needed to Correctly Sort Values

    That worked! Thanks so much! I had to pay more attention to the sorting options, but that worked perfectly when I more carefully followed instructions.

    Again, thanks!
    Last edited by momus44; 08-18-2010 at 07:19 PM. Reason: Editing because I was mistaken.

+ 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