Custom sorting in Excel lets you arrange data in a specific, non-alphabetical or non-numeric order—like sorting products by priority (Critical > High > Medium > Low) instead of alphabetically. It requires your data to be in a structured table or contiguous range with clear headers; no add-ins or special tools are needed.

What You'll Need

  • A Microsoft Excel workbook (Excel 2010 or later on Windows/macOS)
  • Data organized in rows or columns with consistent headers
  • Clear understanding of your desired sort order (e.g., custom list like days of the week, or priority levels)

Step-by-Step

  1. Prepare your data: Ensure your dataset has a single row of headers (e.g., "Product", "Priority", "Region") and no blank rows or columns within the range you want to sort. Select any cell inside your data range (e.g., cell B5 if your table starts at B4).
  2. Open the Sort dialog: Go to the Data tab on the ribbon, then click Sort (not the A→Z or Z→A buttons). A warning may appear asking whether to expand the selection—click Expand the selection to sort all columns together, or Continue with the current selection only if you’ve intentionally selected a partial range (rarely recommended).
  3. Add the first sort level: In the Sort dialog box, under Column, choose the header you want to sort by (e.g., "Priority"). Under Sort On, keep the default Values. Under Sort By, select Custom List from the dropdown.
  4. Define your custom order: A new dialog titled Custom Lists will open. If your list (e.g., "Critical, High, Medium, Low") already exists in Excel’s built-in or previously saved custom lists, select it and click Insert List to add it to the current sort. If not, type your desired order—separate items with commas or press Enter after each item—in the Custom Lists box (e.g., type Critical, High, Medium, Low on separate lines or comma-separated), then click Add.
  5. Confirm the list and sort: Close the Custom Lists dialog by clicking OK. Back in the Sort dialog, verify the order is correct (e.g., "Critical" appears first). You can add secondary sort levels by clicking Add Level (e.g., sort by "Region" next, alphabetically), but only do this if needed for tie-breaking.
  6. Apply the sort: Click OK in the Sort dialog. Excel will reorganize your rows according to your custom list. If you used a table (Ctrl+T to convert), sorting preserves table formatting and filters automatically.

Common Mistakes

  • Skipping the "Expand the selection" prompt: If you ignore it and just click Sort without selecting all data, only one column sorts—breaking your data alignment.
  • Using inconsistent entries: "critical" vs. "Critical" or "High priority" vs. "High" won’t match in your custom list. Ensure exact spelling, capitalization, and spacing.
  • Adding spaces after commas in the Custom List dialog: Excel treats "High, Low" as two items, but "High , Low" creates three items (including an empty third). Keep spacing strict.
  • Trying to sort text as numbers: If your custom list includes numbers (e.g., "1", "2", "3"), Excel may sort them numerically (1, 10, 2) unless you format them as text first or enclose them in quotes in the list.
  • forgetting to save the custom list for reuse: If you add a list in the Custom Lists dialog and close without clicking OK, it won’t persist to future workbooks unless you save the workbook.

Tips

  • Predefine lists in a hidden sheet: Type your custom order (e.g., A1:A4 = Critical, High, Medium, Low) in a hidden worksheet, then in the Custom Lists dialog, click Import and select that range to add it reliably.
  • Sort by multiple custom lists: You can add multiple sort levels, each with its own custom list (e.g., first by "Status" custom order, then by "Severity" custom order).
  • Use wildcards for partial matches: Not applicable—custom lists require exact matches. For partial matches, use helper columns with formulas (e.g., =IF(A2="*Urgent*",1,2)) and sort by the helper.
  • Keyboard shortcut: Alt → A → S → S opens the Sort dialog quickly (Alt for ribbon, A for Data tab, S twice for Sort).
  • Preserve original order: Copy your data to a new sheet first before sorting, in case you need to revert. Excel doesn’t have a built-in "undo sort" beyond Ctrl+Z (which only works immediately after).
  • For pivot tables: Custom sorting works differently—right-click a field in the pivot, choose Sort > More Options, then select Custom List.

Troubleshooting

If your custom sort doesn’t follow your list order:

  1. Check for hidden characters: Copy your custom list items into a plain-text editor (e.g., Notepad) to spot invisible spaces or non-breaking spaces (press Ctrl+H to find/replace them).
  2. Verify list case: Excel is case-insensitive by default, but if you used mixed case in the list and also in your data (e.g., "HIGH" vs. "High"), sort may fail. Standardize case first using =UPPER() or =LOWER().
  3. Confirm you selected the right column: Re-run the sort and double-check the "Column" field matches the header exactly (e.g., "Priority" not "Priority Level").
  4. Test with a small range: Copy 5–10 rows to a new sheet and sort there. If it works, your original data likely has merged cells, blank rows, or inconsistent data types.
  5. Check for Excel’s built-in list interference: If you sorted by "Month" or "Day", Excel might use its default list instead of yours. Explicitly re-add your custom list in the Custom Lists dialog to override it.
  6. Restart Excel: Rarely, a stuck sort state occurs. Close and reopen the workbook, then retry.

Frequently Asked Questions

Can I save a custom sort order to reuse in other workbooks?

Yes—when you add a custom list in the Custom Lists dialog and click OK, it saves to Excel’s global settings. It will appear in future workbooks under the Custom List dropdown. To export/import, copy the list items to a text file, then re-add them in another workbook.

Why does Excel ignore my custom list and sort alphabetically?

Most commonly because your list items don’t exactly match the data (e.g., extra spaces, different capitalization). Also, if you selected "Values" instead of "Custom List" in the Sort dialog, it defaults to alphabetical. Re-check step 3 and ensure the dropdown says "Custom List".

Can I sort numbers like 1, 2, 3 in a custom order (e.g., 2, 1, 3)?

Yes—format the column as text before entering numbers, then include them as text in your custom list (e.g., type "2","1","3" or just 2, 1, 3 in the list). Excel will sort them as text strings per your order.

Does custom sorting work with filtered data?

Yes, but only if you apply the sort after filtering. If you sort while filters are active, Excel sorts only the visible (filtered) rows. To avoid surprises, clear filters first (Data tab > Clear) if you want to sort all data.

How do I remove a custom sort list?

Go to File > Options > Advanced (Windows) or Excel > Preferences > General (macOS), scroll to Custom Lists, select your list, and click Delete. Note: This removes it globally, affecting all future sorts.

Can I use formulas to create dynamic custom sorts?

Yes—use a helper column with =SWITCH(), =IFS(), or nested =IF() to assign numeric priorities (e.g., =IF(A2="Critical",1,IF(A2="High",2,3))) and sort by that column numerically. This is more reliable than text-based custom lists for large or changing datasets.