Google Sheets Sort by Custom Order: Step-by-Step Guide
In this article
Google Sheets has no built-in “sort by custom order” button, but you can get exactly that result with a helper column that assigns a number to each item in your preferred sequence, then sorting by that number. The helper column approach works on both desktop and mobile, needs no add-ons, and keeps your original data intact if you sort a copy or use a formula-driven range.
What You'll Need
- A Google Sheet with the column you want to sort (for example, a Status column with values like High, Medium, Low).
- Edit access to the sheet — if it is shared as View only, make a copy first (File > Make a copy).
- A clear list of the values in your desired order, written somewhere you can refer to (a scratch area of the sheet or a notes app).
- Optional: a second empty column next to your data for the helper numbers. Labels and menu names can differ slightly by Sheets version, browser, or region.
Step-by-Step
- Write down your custom order. List every distinct value in the column you want to sort, in the exact order you want them to appear. For a Priority column, that might be: Critical, High, Medium, Low. Include every value that appears in the data — anything missing from your list will sort unpredictably or be left out of a lookup-based helper.
- Add a helper column. Click the header of the first empty column to the right of your data and type a name such as “Sort Order”. Leave the cells below it empty for now.
- Enter the order numbers. In a small block of empty cells — say, two columns off to the side or on a separate scratch sheet — type each value from your list in one column and its position number in the next: Critical = 1, High = 2, Medium = 3, Low = 4. This lookup table is what the helper formula will read.
- Write a lookup formula in the helper column. In the first data row of the helper column, enter a formula that finds the value in your lookup table and returns its number. With the lookup table in columns H and I (values in H, numbers in I) and your data value in A2, the formula is
=IFERROR(VLOOKUP(A2,$H$2:$I$5,2,FALSE),""). The dollar signs lock the lookup range so it does not shift when you fill the formula down. IFERROR leaves the cell blank instead of showing #N/A when a value is not in your list. If your version of Sheets supports it, XLOOKUP is a cleaner alternative:=IFERROR(XLOOKUP(A2,$H$2:$H$5,$I$2:$I$5),""). - Fill the formula down. Select the cell with the formula, grab the small square at its bottom-right corner (the fill handle), and drag down to the last row of your data. Alternatively, copy the cell and paste it into the rest of the column. Every row should now show a number next to it.
- Select the whole data range. Click the first cell of your data (including headers) and drag to the last cell in the helper column, or press Ctrl+A (Cmd+A on Mac) with a cell in the range selected. Do not select only the helper column — sorting a single column scrambles rows against the rest of the data.
- Open the sort dialog. Go to Data > Sort range > Advanced range sorting options. Tick “Data has header row” so Sheets keeps your header labels out of the sort. In the “Sort by” dropdown, choose your helper column (“Sort Order”), set the order to A–Z (ascending), and click Sort.
- Check the result and tidy up. Your rows should now follow your custom sequence. If you want to keep the sheet clean, you can hide the helper column (right-click the column header > Hide column) rather than deleting it, so the formula stays available if you add rows later. If you add new rows, fill the helper formula down again before re-sorting.
- On mobile: the Sheets app has no full sort dialog. Create the helper column with the same formula, then select the range, tap the three-dot menu, choose “Create a filter”, and use the filter arrow on the helper column header to sort A–Z. Filters and sort options in the mobile app are more limited than on desktop.
Common Mistakes
- Sorting only one column. If you select just the helper column and sort, the numbers move but the rest of each row stays put, so values no longer match their rows. Always select the entire data range first.
- Forgetting to lock the lookup range. Without dollar signs, filling the formula down shifts the lookup table and later rows return wrong numbers or errors.
- Missing values in the lookup table. Any value not listed gets a blank helper cell and ends up grouped together at the top or bottom. Add every distinct value, including blanks if you want them placed deliberately.
- Leaving “Data has header row” unticked. Sheets then treats your header as data and may sort it into the middle of the list.
- Deleting the helper column after sorting. The order stays, but if you add rows later you have to rebuild the helper from scratch. Hiding it is usually better.
- Expecting the sort to update automatically. Sorting is a one-time action. New rows are not re-sorted until you run the sort again.
Tips
- Work on a copy (File > Make a copy) before sorting a sheet you cannot easily undo, and remember Ctrl+Z (Cmd+Z) reverses a sort if you catch the mistake straight away.
- Name your lookup range (select it, then Data > Named ranges) and use that name in the formula — for example
=IFERROR(VLOOKUP(A2,PriorityOrder,2,FALSE),"")— so the formula stays readable. - For a fully automatic version, put the data and helper formula inside a formula-driven range such as SORT or QUERY, or use the Filter views feature (Data > Filter views) to save a custom sort you can reapply without touching the underlying order.
- If you only need to group rows by category rather than order them, a pivot table with the category as rows may be simpler than a helper column.
- Keep the lookup table on the same sheet but out of the sorted range, or on a separate sheet, so sorting never moves it.
Troubleshooting
The helper column shows #N/A or blanks. The value in that row is not in your lookup table, or the lookup range is wrong. Check for trailing spaces (use TRIM around the value) and confirm the range covers every row of the table.
The sort puts everything in the wrong order. The helper numbers are probably text rather than numbers, or the sort order is set to Z–A instead of A–Z. Re-enter the numbers as plain digits and check the order dropdown in the sort dialog.
Rows no longer line up after sorting. You sorted a partial range. Undo immediately with Ctrl+Z, then reselect the full range including the helper column and sort again.
The Sort range option is greyed out. The sheet may be view-only, or a filter may be active on the range. Remove the filter (Data > Turn off filter) or make a copy you can edit.
New rows appear in the wrong place. Sorting is not live. Fill the helper formula into the new rows and run Data > Sort range again.
Frequently Asked Questions
Does Google Sheets have a built-in custom sort list like Excel?
No. Sheets offers A–Z, Z–A, and sort-by-column options, but no saved custom list. The helper column method described above is the standard workaround.
Can I sort by more than one custom order at once?
Yes. Add a second helper column with its own lookup table and formula, then in the sort dialog add a second sort rule under “Then by”. The first rule takes priority, and the second breaks ties.
Will sorting break my formulas?
Relative references usually move with their rows, but absolute references to fixed cells can point at the wrong data after a sort. Check key formulas after sorting, and keep lookup tables outside the sorted range.
Can I undo a sort?
Yes, immediately after sorting use Ctrl+Z (Cmd+Z on Mac) or the Undo button. Once you close the sheet or make many later edits, undo may no longer reach back to the sort, so keep a copy if the data matters.
Does the mobile app support custom sorting?
Only partially. The Sheets app lacks the full sort dialog, so use a filter on the helper column and sort A–Z there. For complex multi-level sorts, use the desktop browser version.
Can I keep the custom order without showing the helper column?
Yes. Right-click the helper column header and choose Hide column. The values stay in place and the sort result is unaffected.