Unexpected Results Using a Custom Sort Order (151346)
The information in this article applies to:
- Microsoft Excel 97 for Windows
- Microsoft Excel 98 Macintosh Edition
This article was previously published under Q151346 SYMPTOMS
You can use a custom sort order to sort data in Microsoft Excel. You can
only use a custom sort order as the first sort key. If you use the custom
sort order with any key other than the first sort key, it is ignored.
RESOLUTION
The custom sort order is meant to be used with the first sort key. To use
a custom sort order for a sort key other than the first sort key, the
sorts must be performed separately. For example, if the custom sort order
is the second sort key, run the sort procedure twice, using one sort key
each time, instead of running the sort procedure once using two sort keys.
First sort the data by using only one sort key (using a sort order that
is built into Microsoft Excel). Then run the sort procedure again, by
using only ne sort key with a custom sort order. The following
example shows how to do this.
Example- Create a new worksheet in Microsoft Excel.
- On the Tools menu, click Options. If you are using Microsoft Excel on
the Macintosh, click Preferences on the Tools menu.
- Click the Custom Lists tab, and then click Add.
- Under List Entries, type the following list:
North Carolina
Texas
Arizona
Washington
Click the Add button, to add your custom list. Click OK. - Type the following into Sheet1:
A1: NAME B1: LOCATION
A2: Mary B2: Arizona
A3: Joe B3: Washington
A4: John B4: Texas
A5: Paul B5: Texas
A6: Sue B6: North Carolina
A7: Don B7: North Carolina
A8: Alice B8: Arizona - Select the data range A1:B8.
- Click Sort on the Data menu.
- Under My List Has, make sure that Header Row is selected.
- In the Sort By list, click NAME and click Ascending. Click OK.
Microsoft Excel has now sorted the list once using the sort order
built into it.
- Reselect the data range A1:B8.
- Click Sort on the Data Menu.
- Under My List Has, make sure that Header Row is selected.
- In the Sort By list, click LOCATION.
- Click Options. Select the custom list (that you added at the beginning of the example) from the "First Key Sort Order" box. Click OK.
- In the Sort box, click OK.
The data has now been sorted so that the second sort key is using a custom
sort order.
REFERENCES
For more information about Using a Custom Sort Order, click the Search
button in Help and type:
custom sort order
Modification Type: | Major | Last Reviewed: | 6/23/2005 |
---|
Keywords: | kbhowto kbprb KB151346 |
---|
|