October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Mountain View desk3 min

How to Create a Custom Sort Order in Google Sheets

Create a custom Google Sheets sort order by ranking values against a helper list, or choose range sorting, SORT, or SORTN for other sorting needs.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Google Sheets does not provide a built-in menu for defining an arbitrary list order such as “In progress, Waiting, Done.” To sort by a custom sequence, put the preferred order in a helper range, assign each row a rank based on that list, and sort by rank. For standard multi-column sorts, use Data > Sort range > Advanced range sorting options.

Choose the sorting method that fits

Method What it does Best for
Sort range Rearranges the selected cells in place. Standard ascending or descending sorts, including multiple priority columns.
SORT Generates a sorted output while leaving the source data in place. A separate view that updates when source data changes; supports multiple keys.
Helper list and rank Turns an arbitrary preferred sequence into a numeric sort key. Custom orders such as workflow stages or months beginning in a chosen month.
SORTN Sorts and returns a limited number of results. A top-n list rather than the full dataset.

Sort a range by standard columns

  1. Select the data range you want to sort.
  2. Choose Data > Sort range > Advanced range sorting options.
  3. Enable the option indicating that the range has a header row if the first row contains column names. This keeps the headers out of the sort.
  4. Choose the first sort column and its direction. Add further sort columns in priority order; each later key sorts rows tied on the preceding keys.
  5. Click Sort.

To sort an entire sheet by one column, right-click that column’s letter and choose Sort sheet A to Z or Sort sheet Z to A. Google documents these desktop steps in its sorting and filtering instructions.

Create an arbitrary custom order with a helper list

Write each allowed value in the order you want it sorted, one value per cell. For example, a status list might be “Not started,” “In progress,” “Waiting,” “Done.” Then give every data row the position of its value in that list and sort by that position. The rank, rather than the text itself, determines the order.

Example using a helper list and a formula

Suppose the values to sort are in column A, the desired sequence is in G2:G, and you want a formula-generated sorted output in column B. A Google Docs Editors Community example uses:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
The Google Workspace Bible: [14 in 1] The Ultimate All-in-One Guide from Beginner to Advanced | Including Gmail, Drive, Docs, Sheets, and Every Other App from the Suite
  • The Google Workspace Bible: [14 in 1] The Ultimate All in One Guide from Beginner to Advanced Including Gmail, Drive, Docs, Sheets, and Every Other App from the Suite
  • ABIS BOOK

={"Sorted Output";ARRAYFORMULA(Query({A2:A,Match(A2:A,G2:G,0)},"Select Col1 Where Col1 is not null Order by Col2",0))}

The formula matches each value in A against the list in G, orders rows by the resulting match position, and labels the output column. It is a community-contributed example, not a dedicated official feature guide; the example was posted on May 1, 2022. See the community example.

Check for values missing from the list

MATCH needs each sortable value to appear in the priority list. Decide what should happen to any unlisted value—such as whether to add it to the list or exclude it—before relying on the resulting order. The cited example does not define a general policy for unmatched values.

The example uses US formula syntax. Depending on the spreadsheet’s locale, separators and formula syntax may differ.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Generate a sorted view with SORT

Use SORT when you want the source data to remain in place and a separate sorted result. Its syntax is SORT(range, sort_column, is_ascending, [sort_column2, is_ascending2, ...]). The sort column can be an index within the range or an external single-column key range with the same number of rows as the data. Use TRUE for ascending and FALSE for descending order. Optional key-and-direction pairs add tie-breakers in precedence order.

For a custom sequence, calculate a rank for each row from the helper list, then use that rank as the sort key. The official SORT function documentation explains the function’s arguments and external sort-key ranges.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Return only the top n sorted rows with SORTN

Use SORTN when you need a limited sorted result, not a rearrangement of the full dataset. Its syntax is SORTN(range, [n], [display_ties_mode], [sort_column1, is_ascending1], ...). It sorts the range and returns the first n items. The documented tie modes control whether the result is limited to n rows, includes rows identical to the nth row, removes duplicate rows, or returns unique rows and their duplicates. See Google’s SORTN documentation.

Sort by color—and know the limits

Google Sheets desktop sorting controls can move cells with a selected text or fill color to the top of a range. Conditional-formatting colors can be used; alternating colors cannot. The documented workflow does not describe assigning several color priorities, such as green, then orange, then red. If you need that sequence, represent the priorities in a helper column and sort by its values instead. Google’s desktop sorting instructions cover the color option.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.