Sort a Report into a Custom Sequence
September 01, 2022 - by Bill Jelen
Problem: My manager wants me to sort a report geographically. My annual report typically lists results from the United States first, then Europe, and then Australia. I need to sort so that the countries appear as United States, England, France, Germany, and Australia.
Strategy: You can use a custom list by following these steps:
1. Go to a blank section of the worksheet. Type the countries in the order you want them to appear in a column. Select the range of cells.
2. Choose File, Options, Advanced. Scroll to near the bottom of the dialog. The Edit Custom Lists button is now found at the bottom of the General category. In Excel 2007, this button was at the top of the first screen of the Options dialog. Click Edit Custom Lists.
-
3. Provided you selected the data in step 1, the reference box next to the Import button already contains the cells that contain your list. Click Import.
4. Click OK twice.
5. Select Data, Sort. In the Sort dialog, choose Country from the Sort By dropdown. In the Order dropdown, choose Custom List.
6. Excel will again display the Custom Lists dialog. Select the USA, England, France list and click OK.
7. When Excel shows USA, England, France, Germany in the Order dropdown, click OK to sort.
Results: The data is sorted by the country order.
Additional Details: If there is a value in the column that is not in your custom list, it is sorted alphabetically after the entries in the list. If you sort in descending order, these unlisted entries will come first, in Z–A order.
Gotcha: Excel remembers that the column was most recently sorted by the “USA, England…” custom list. If you click the AZ button, it will automatically sort by using this same custom list. If you need to return to alphabetical order, you will have to select Data, Sort and choose A to Z in the Order dropdown.
This article is an excerpt from Power Excel With MrExcel
Title photo by GeoJango Maps on Unsplash