Google Sheets Tips

How to sort data in Google Sheets: by column, by multiple columns, by date and by color

To sort data in Google Sheets, select a cell in the column and choose Data > Sort sheet, or select a range and choose Data > Sort range. This guide walks through both, then sorting by multiple columns, by date and number, by color, inside a filter or a filter view, in a custom order, and with the SORT function, and explains the order Sheets uses for numbers, text and empty cells.

Google Sheets TipsVadym Kramarenko8 min read

How to sort data in Google Sheets: by column, by multiple columns, by date and by color

To sort data in Google Sheets, click a cell in the column to sort by and choose Data > Sort sheet > Sort sheet by column (A to Z). To sort only a part of the sheet, or by more than one column, select the range and choose Data > Sort range > Advanced range sorting options.

You want to Use
Sort the whole sheet by one column Data > Sort sheet
Sort a selected range, keep the rest in place Data > Sort range
Sort by multiple columns Data > Sort range > Advanced range sorting options
Sort and filter from the header row Data > Create a filter
Sort without changing what others see Data > Create filter view
Sort by cell or text color A filter, then Sort by color
A sorted copy that updates by itself The SORT function

“A to Z” means ascending for every kind of data: A before B, smaller numbers before larger, older dates before newer. “Z to A” is the reverse.

Sort the whole sheet by one column

Sort the whole sheet by one column

Sort sheet reorders every row of the sheet, so all columns stay together. First protect the header: a header row that is not frozen gets sorted into the data.

  1. Choose View > Freeze > 1 row, or as many rows as the header takes.

Google Sheets with the View menu open on Freeze and its options: No rows, 1 row, 2 rows, Up to row 2

  1. Click any cell in the column to sort by.
  2. Choose Data > Sort sheet, then A to Z or Z to A.

Google Sheets with the Data menu open on Sort sheet, offering Sort sheet by column B (A to Z) and Sort sheet by column B (Z to A)

Google Sheets with customer names in column B sorted from Alice Johnson to Jack Lee and each region still next to its customer

The same two commands sort dates and numbers. On a date column, A to Z puts the oldest date first:

Google Sheets with an orders table sorted by the Order Date column from 01/05/2025 to 11/08/2025

On a number column, Z to A puts the largest value first:

Google Sheets with a product table sorted by Price per Unit from 1200 down to 50

Sort a range

Sort a range

Sort range reorders only the selected cells. Everything outside the selection stays where it is, which is what you want for one table on a sheet that holds several, and a risk when the selection misses a column: the sorted columns then no longer line up with the unsorted ones. Select the whole table.

  1. Select the range, with its header row.
  2. Choose Data > Sort range > Advanced range sorting options.

Google Sheets with the Data menu open on Sort range, offering Sort range by column B (A to Z), (Z to A) and Advanced range sorting options

  1. Tick Data has header row. The header is then left in place, and the column list shows names instead of letters.
  2. Choose the column and the direction, and click Sort.

The Sort range dialog of Google Sheets for B2 to D12 with Data has header row ticked, Sort by set to Customer Name and A to Z selected

The two quick commands in the same menu, Sort range by column (A to Z) and (Z to A), sort by the column named in the command and treat every selected row as data, so leave the header out of the selection when using them.

The Turning Point

OWOX Data Marts

See your first report built in real time. 15 minutes.

  1. Connect your data warehouse
  2. Pick your metrics
  3. Get a live Google Sheets report

In the time it takes to write a ticket. Then imagine never writing that ticket again.

Book a Demo

We'll use your actual use case

Sort by multiple columns

Sort by multiple columns

In the same dialog, Add another sort column adds a second level. Rows are sorted by the first column, and rows with the same value there are sorted by the second.

The Sort range dialog with two levels: Sort by Region A to Z, then by Product A to Z, and the Add another sort column button

Google Sheets with a table sorted by Region and, inside each region, by Product: East with Headphones, Microwave Oven and Smartphone first

Each level has its own direction: region A to Z and then revenue Z to A lists the largest values first inside each region. More levels can be added the same way.

Sort from the header row with a filter

Sort from the header row with a filter

Data > Create a filter adds a button to each header cell. Its menu sorts the filtered range by that column and holds the filter conditions.

Google Sheets with the filter menu of the Region column open: Sort A to Z, Sort Z to A, Sort by color, Filter by color, Filter by condition and Filter by values with East ticked

A filter is shared: everyone who opens the file sees the same sorted and filtered rows.

A filter view: your own order

Data > Create filter view gives the same header menus, but the result is a view. Other people keep seeing the data in its original order.

Google Sheets with a temporary filter view on B2:D12 and the menu of the Product column open on Sort A to Z

Google Sheets with the filter view sorted by Product from Coffee Maker to Sofa

Sort by color

Sort by color

With a filter on, the header menu has Sort by color, with Fill color and Text color. The rows with the chosen color move to the top; repeat for the next color to build the full order.

Google Sheets with rows filled in four colors and the filter menu open on Sort by color, Fill color, listing green, cornflower blue, orange and dark red 1

Google Sheets with the table grouped by fill color: red rows, then orange, blue and green

Sort in a custom order

Sort in a custom order

A to Z does not help when the order is a business one: High, Medium, Low, or a fixed order of regions. Two ways:

  • A helper column. Add a column with the position of each value, =MATCH(C3, {"High";"Medium";"Low"}, 0), and sort by it.
  • The SORT function with MATCH as the sort column:

=SORT(C3:D12, MATCH(C3:C12, {"Sarah";"Mike";"John"}, 0), TRUE, 2, FALSE)

In our test this listed all rows of Sarah first, then Mike, then John, each group with its largest amount on top.

A sorted copy that updates: the SORT function

A sorted copy that updates: the SORT function

Menu sorting rearranges the data once. New rows land at the bottom, unsorted, until someone sorts again. The SORT function returns a sorted copy in another place and keeps it up to date:

=SORT(B3:E12, 4, FALSE)

sorts the range by its fourth column, largest first. By two columns:

=SORT(B3:E12, 2, TRUE, 4, FALSE)

The original stays untouched, which also keeps formulas that point at it safe. The full description, with SORTN for top-N lists, is in SORT and SORTN. QUERY sorts with ORDER BY, and a table has sorting in its column menus.

The order Google Sheets uses

The order Google Sheets uses

In our test of a column that mixed kinds of values, sorted with the SORT function:

  • Ascending: numbers first, then text, then TRUE and FALSE. Empty cells came last.
  • Descending: the reverse, and the empty cells still came last.
  • Numbers stored as text sort as text. The text “10” came after the numbers 2 and 3, among the texts.
  • Case is ignored. “A” and “a” are equal for sorting and keep their original order.

A menu sort of the same column, Z to A, gave the same descending order, with the empty cell at the bottom.

Problems and fixes

Problems and fixes

⚠️ Problem: The header row moved into the data.

✅ Solution: Freeze the header before Sort sheet, or tick Data has header row in the Sort range dialog. Undo with Ctrl+Z (⌘+Z on a Mac).

⚠️ Problem: Rows are mixed up: names no longer match their values.

✅ Solution: Only some columns were selected and sorted. Undo, select the whole table and sort again.

⚠️ Problem: Numbers sort as 1, 10, 100, 2.

✅ Solution: They are stored as text. Convert them with VALUE, or with Format > Number > Number after removing stray characters; see TRIM and CLEAN.

⚠️ Problem: Dates are not in order.

✅ Solution: Some of them are text, usually left-aligned in the cell. Convert them to real dates; see dates and times.

⚠️ Problem: Sort range is greyed out, or the sort does nothing.

✅ Solution: Select more than one cell for Sort range. Merged cells inside the range block sorting; unmerge them first.

⚠️ Problem: The order is lost after new rows are added.

✅ Solution: Menu sorting is a one-time action. Use the SORT function for a list that has to stay sorted.

Related guides

Sorting is undone by the next export

Sorting is undone by the next export

A sorted table stays sorted until the data changes. Reports built on pasted exports get re-sorted after every paste, and a sort over a partial selection can scramble a table without any error message.

The OWOX Data Marts extension for Google Sheets covers that half. A data analyst publishes a data mart (a table or an SQL query in your data warehouse) and makes it available for reports. In Sheets you open the extension, pick the data mart, tick the columns you want and run it. The rows land in a tab, ready for your formulas.

Google Sheets with the OWOX Data Marts extension open beside an ad spend table: the Unified Ad Spend data mart, nine of fourteen columns ticked and a Save & Run button – the rows in the sheet come from a governed data mart, not a pasted export

What changes for the person who maintains the sheet:

  • Refresh replaces re-export. Refresh current report in the extension menu re-runs the same pull, and a scheduled refresh keeps the tab current without anyone touching it.
  • The source is written on the sheet. The header cell of an imported tab carries a note with the data mart it came from, the time of the import and a link to the report.
  • No SQL and no warehouse access needed. The analyst decides which data marts and columns are available. You choose from that list.

The extension does not write or change the analyst’s SQL. The sheet then starts from complete, current rows, and a SORT formula built on them keeps its order through every refresh, with sorting by hand left for a quick look from another angle. The extension comes with the OWOX Cloud plans of OWOX Data Marts; spreadsheet reporting describes both ways data reaches a sheet.

Your New Normal

Turn your data into decisions.

Governed data marts give you the clean foundation ML needs to actually work.

  • No AI hallucinations
  • Analyst-governed definitions
  • Every number traces to SQL
Get started free

FAQ

Frequently Asked Questions

How do I keep my headers in place while sorting?

For Sort sheet, freeze the header row with View > Freeze > 1 row: frozen rows are not sorted. For Sort range, open Advanced range sorting options and tick Data has header row.

What should I do if blank cells are sorted at the top or bottom?

In our test, empty cells went to the end of the sorted data in both directions, ascending and descending. To put them first, add a helper column that marks empty cells, for example =IF(C3="", 0, 1), and sort by that column first and by the data column second.

How can I automatically sort data when new rows are added?

Use the SORT function. For example:

> =SORT(A2:D, 1, TRUE)

This dynamically arranges data based on specified columns, updating automatically with new entries.

How do I sort data by date in Google Sheets?

Ensure the date column is formatted as Date (Format > Number > Date). Select the column, click Data > Sort sheet by column A-Z (oldest to newest) or Z-A (newest to oldest).

How do I sort data alphabetically in Google Sheets?

Click a cell in the column and choose Data > Sort sheet > Sort sheet by column (A to Z), or (Z to A) for the reverse. Freeze the header row first with View > Freeze > 1 row so that it stays on top. To sort only a selected range, use Data > Sort range > Advanced range sorting options and tick Data has header row.

Who wrote this

Vadym Kramarenko

Vadym Kramarenko · Growth Marketing Manager

Vadym Kramarenko is a Growth Marketing Manager at OWOX, where he drives user acquisition and product-led growth strategies. He hosts the OWOX podcast, interviewing analytics professionals about data-driven marketing, attribution, and reporting best practices. Vadym specializes in turning complex analytics concepts into practical, actionable marketing frameworks.