Excel: Sort Doesn't Change Order of Lower/Upper Case Letters

Last reviewed: November 2, 1994
Article ID: Q64341

SUMMARY

The Microsoft Excel Sort command (on the Data menu) does not take into account the ASCII value of the characters it is sorting.

For example, if the letter "a" (lowercase) is typed into a cell and the letter "A" (uppercase) is typed into an adjacent cell, choosing Sort from the Data menu will retain the current order of these letters.

Therefore, if a column of "a"'s and "A"'s is entered into a worksheet, executing the Sort command will not change the order of the data.

       D                                                   D
     +---+                                               +---+
   1 | a |   <--- Performing a Data Sort on the        1 | a |
     +---+        values in D1:D4 will return ---->      +---+
   2 | A |                                             2 | A |
     +---+     There is no change in organization.       +---+
   3 | A |                                             3 | A |
     +---+                                               +---+
   4 | a |                                             4 | a |
     +---+                                               +---+

MORE INFORMATION

To sort a column of "a"'s and "A"'s,

  1. Insert a new column to the left of the data.

  2. Enter in the first cell to the left of the data: =CODE(cell_ref). Where "cell_ref" is the first cell with data. For example, using the above data, the a's would now be in column E (due to the insertion of a column). Enter in cell D1, =CODE(E1).

  3. Select the cell with the new formula.

  4. From the Edit menu, choose Fill Down.

  5. Select both columns of data.

  6. From the Data menu, choose Sort. Click OK.

If the data is not a single character, this method will not work. Try using other text functions (such as LEFT, RIGHT, and MID) in a combination with the above idea to achieve the desired results.


KBCategory: kbother
KBSubcategory:

Additional reference words: noupd


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 2, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.