+ Reply to Thread
Results 1 to 11 of 11

Sort with case sensitive (AC before Ab)

  1. #1
    Registered User
    Join Date
    11-27-2013
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    7

    Sort with case sensitive (AC before Ab)

    Hi, all:

    I have a huge spreadsheet and I need to sort the rows based on the values of column A. The desired behavior is that it is sorted alphabetically but uppercase letters should appear first, ie. AC should come before Ab.

    I have checked the "case sensitive" box in Sort options and tried creating a custom list, but it hasn't worked. Would any of you know what to do?

    Thanks for your help

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Sort with case sensitive (AC before Ab)

    Are they all two letter codes?
    How many codes are there?
    If there aren't too many type them into a table with a number next to them 1 to however many there are and sort on the number.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,064

    Re: Sort with case sensitive (AC before Ab)

    Can you give us a few examples of the REAL text that you are trying to sort in this way, and the expected answer?
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: Lá fhéile Pádraig sona dhaoibh

  4. #4
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Sort with case sensitive (AC before Ab)

    you can make a liste with the unique values in column A (e.g in column P)

    Then you can (manualy) sort those values.

    After that you could use VLookup in a helpcolum, which will help you by sorting the data.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  5. #5
    Registered User
    Join Date
    11-27-2013
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Sort with case sensitive (AC before Ab)

    Thanks for your quick replies!

    The file is pretty big (over 3,000 rows) and no value of column A is repeated, so I have over 3,000 unique values. Some of them are 2 letters but most are pretty big, they could be entirely in uppercase, entirely in lowercase or mixed, but the rule I need is always the same: first A-Z and then a-z, isn't there a simple way to sort it?

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,064

    Re: Sort with case sensitive (AC before Ab)

    OK. First attempt at a solution for you...

    Put this in B1 (assuming that your data start in A1) and copy down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Then select both columns, DATA, SORT, Sort by Column B smallest to largest; then by Column A, A to Z.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    11-27-2013
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Sort with case sensitive (AC before Ab)

    Thanks a lot Glenn, that is a pretty impressive formula. It took me a while to understand the reasoning behind it and I learned a new trick with it However, the result is not the desired. If I had these 3 words: About, ALL and BOOT, this is how the formula sorts them:

    1) ALL
    2) BOOT
    3) About

    The desired result would be:

    1) ALL
    2) About
    3) BOOT

    In other words, it should work like a regular alphabetically sort but as if the alphabet were 52 letters long, starting with A-Z and then a-z. I see there is no easy way to do it without using formulas, that's a shame

    Thanks anyways

  8. #8
    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: Sort with case sensitive (AC before Ab)

    UDF?

    Please Login or Register  to view this content.
    A
    B
    C
    1
    ALL 414C4C B1: =hexcode(A1)
    2
    About 41626F7574
    3
    BOOT 424F4F54


    Sort by col B.
    Entia non sunt multiplicanda sine necessitate

  9. #9
    Registered User
    Join Date
    11-27-2013
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Sort with case sensitive (AC before Ab)

    Cool, thanks, that is exactly what I needed, you saved my day!!!

  10. #10
    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: Sort with case sensitive (AC before Ab)

    You're welcome.

    It will only work (sorting-wise) for strings up to 127 characters.

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,064

    Re: Sort with case sensitive (AC before Ab)

    It eventually dawned on me... stupidly simple, actually. It needs no code, but does need two helpers. I post it only 'cos I don't like to be beaten by a straightforward request!!
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Case-sensitive sort code, but not alfabethical
    By Tinwelende in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 05-13-2014, 03:18 PM
  2. [SOLVED] SUMPRODUCT Or SUMIF - In case of Case sensitive???
    By lifeisaspreadsheet in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-28-2012, 07:57 AM
  3. [SOLVED] Case Sensitive w/ IF
    By jeffP in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 02-05-2006, 09:20 PM
  4. .Name case sensitive
    By CinqueTerra in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-16-2006, 05:00 PM
  5. Case Sensitive
    By hemants in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-09-2005, 04:20 AM

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