Function Problems

Sort an Entire Excel Table Using a Custom List

John WilsonJohn Wilson Nov 18, 2026 869 views

Question details

The user wants to sort an entire Excel table by a custom category order while keeping related columns aligned.

Sort an Entire Excel Table Using a Custom List
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.
Before you start

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.

Solution 1Recommended

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.

1
Select the full table

Select the entire data range, including all related columns and headers. Alternatively, click a cell in an existing Excel Table.

2
Open the Sort dialog

Go to Data > Sort. If prompted, choose Expand the selection so the related columns are included.

3
Choose the category column

In the Sort dialog, check My data has headers if applicable, then choose the category column under Sort by.

4
Select or create the list

Under Order, choose Custom List. Select an existing list, or choose New List, enter the categories in the desired order, and click Add.

5
Apply the sort

Click OK to confirm the custom list, then click OK in the Sort dialog. Check that related values remain together in each row.

Sort the entire table with an Excel custom list
Keep rows together: Do not sort only the category column independently; doing so can separate categories from their related data.
Sort with WPS Spreadsheets

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. 1. Open the workbook: Open WPS Spreadsheets and choose Open to select your Excel workbook.
  2. 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. 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. 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.
Sort categories in a custom order while keeping related rows togetherOpen and edit Microsoft Excel XLS and XLSX filesUse a free spreadsheet application with a familiar interface
microsoft office alternative - wps office

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.