Microsoft KB Archive/64341

{| = Excel: Sort Doesn't Change Order of Lower/Upper Case Letters =
 * width="100%"|

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 &quot;a&quot; (lowercase) is typed into a cell and the letter &quot;A&quot; (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 &quot;a&quot;'s and &quot;A&quot;'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 &quot;a&quot;'s and &quot;A&quot;'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 &quot;cell_ref&quot; 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.
 * }