SORT function in Google Sheets
SORT returns a range sorted by one or more columns and leaves the original data where it is. In Google Sheets you give the column number and TRUE for ascending or FALSE for descending, then add more column and order pairs as tie-breakers.
- Works in
- Google Sheets, with different arguments from Excel
- Returns
- An array: the rows of range in the new order.
Syntax
=SORT(range, sort_column, is_ascending, [sort_column2, is_ascending2, ...])
| Argument | Required? | What it is |
|---|---|---|
range | Required | The data to sort, usually without the header row. |
sort_column | Required | The column to sort by: a number counted from the left edge of range, or a separate one-column range the same height. |
is_ascending | Required | TRUE for A to Z and smallest first, FALSE for Z to A and largest first. |
Examples
Each result is calculated from the sample sheet by our formula engine in Sheets mode, the same one that grades the practice.
| Cell | Formula | Result | What it shows |
|---|---|---|---|
| E2 | =SORT(A2:C7,3,FALSE) | Kimspills 6 × 3 | Column 3 (Sales), largest first |
| I2 | =SORT(A2:C7,2,TRUE,3,FALSE) | Samspills 6 × 3 | Region A to Z, then the biggest sales first within each region |
| M2 | =SORT(A2:A7) | Anaspills 6 × 1 | Just a range: sorts by its first column, A to Z |
Try it live
This is the sample sheet. Change any value or edit a formula, and the results update.
Practice SORT
Graded instantly in Sheets mode, then re-checked on changed data.
Revenue leaderboard
E2, sort the reps (columns A to C) by revenue, largest first.Common mistakes
| What you see | Why, and how to fix it |
|---|---|
| Largest values end up last | is_ascending is TRUE or FALSE in Sheets. Use FALSE for largest first; a -1 copied from an Excel formula doesn't sort descending here. |
| The header row lands in the middle of the list | Start range below the header: SORT(A2:C7,3,FALSE), not A1:C7. Keep the header in the row above the formula. |
| It sorts by the wrong column | sort_column counts from the first column of range, not from column A. In SORT(C2:E7,2,FALSE), 2 means column D. |
| #REF! with "Array result was not expanded" | The cells the sorted rows need aren't empty. Clear them, including any old values pasted below the formula. |
Tips
- Sort filtered results in one step: =SORT(FILTER(A2:C7,B2:B7="East"),3,FALSE).
- Sort by a column you don't show by passing a range as sort_column: =SORT(A2:A7,C2:C7,FALSE) lists names from best sales to worst.
SORT in Excel
Excel's SORT takes 1 for ascending and -1 for descending instead of TRUE and FALSE, and adds a by_col argument. To sort by several columns, Excel users usually reach for SORTBY.
Questions
How do I sort by two columns in Google Sheets?
Add another column and order pair: =SORT(A2:C7,2,TRUE,3,FALSE) sorts by region A to Z, then by sales from largest within each region.
Does SORT change my original data?
No. It writes a sorted copy where the formula is. To reorder the data itself, use Data > Sort range instead.
Last reviewed October 2026. Every example result on this page is calculated live by the Spreadsheet Practice formula engine in Sheets mode.