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.

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.
- Choose View > Freeze > 1 row, or as many rows as the header takes.

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


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

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

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.
- Select the range, with its header row.
- Choose Data > Sort range > Advanced range sorting options.

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

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.
OWOX Data Marts
See your first report built in real time. 15 minutes.
- Connect your data warehouse
- Pick your metrics
- Get a live Google Sheets report
In the time it takes to write a ticket. Then imagine never writing that ticket again.
Book a DemoWe'll use your actual use case
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.


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.

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.


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.


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
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
⚠️ 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
- SORT and SORTN: Sorting with formulas.
- FILTER: Rows that meet a condition.
- Tables: Ranges with built-in sort and group menus.
- Slicers: Filters for charts and pivot tables.
- Pivot tables: Sorted summaries by group.
- Remove duplicates: Clean the list before sorting.
- RANK: The position of each value without moving rows.
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.

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.
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
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.



