Sort an Entire Excel Table Using a Custom List
Question details
The user wants to sort an entire Excel table by a custom category order while keeping related columns aligned.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A table contains categories that need to be sorted in a specific order rather than alphabetically.
- Observed behavior
- The desired result is a table sorted by the custom category list, with each row's values remaining together.
Check that the table has a header for each column and identify the category column to sort. Decide on the exact category order and make sure the list entries match the values in that column.
Sort the entire table with an Excel custom list
Use Excel's Sort dialog to apply a predefined or newly created category order to the full table.
Select the entire data range, including all related columns and headers. Alternatively, click a cell in an existing Excel Table.
Go to Data > Sort. If prompted, choose Expand the selection so the related columns are included.
In the Sort dialog, check My data has headers if applicable, then choose the category column under Sort by.
Under Order, choose Custom List. Select an existing list, or choose New List, enter the categories in the desired order, and click Add.
Click OK to confirm the custom list, then click OK in the Sort dialog. Check that related values remain together in each row.

Apply a custom category order in WPS Spreadsheets
Use a helper column to assign each category a position in your list, then sort the entire data range by that position.
- 1. Open the workbook: Open WPS Spreadsheets and choose Open to select your Excel workbook.
- 2. Enter the custom order: In an unused area, enter the categories in the desired order, one per cell. For example, use J2:J5 if those cells are empty.
- 3. Add a sort key: Add a helper column immediately beside the data. If the first category is in A2 and the list is in J2:J5, enter =IFERROR(MATCH(A2,$J$2:$J$5,0),9999) in the first helper cell and fill it down. Adjust the references to match your sheet.
- 4. Sort the full range: Select all data columns and the helper column, including headers, but exclude the separate custom list. Choose Data > Sort and sort the helper column in ascending order.

Frequently Asked Questions
How do I create a custom sort list in Excel?
Select the table and go to Data > Sort. Choose the category column, select Custom List under Order, then choose New List, enter the categories in order, and click Add.
How can I keep the other columns aligned when sorting?
Select the entire data range before choosing Data > Sort. If Excel asks whether to expand the selection, choose Expand the selection.
What happens to categories missing from the WPS helper-column list?
With the suggested IFERROR and MATCH formula, unmatched categories receive a sort key of 9999 and appear after the listed categories when sorted in ascending order.
Can I remove the helper column after sorting in WPS Spreadsheets?
Yes. After sorting the full range, select the helper column and delete it if you no longer need the sort keys.




