SORT Function in Google Sheets
Use SORT to return a range ordered by one or more columns — a live sorted copy that updates as the data changes, without touching the original.
=SORT(A2:C, 2, FALSE)
Returns A2:C ordered by the 2nd column, descending (FALSE). Use TRUE for ascending.
How it works
SORT takes a range, a sort column (counted from the left of the range, starting at 1), and a direction — TRUE for ascending, FALSE for descending. Add more column/direction pairs to break ties. The result spills and updates live, so it never changes your source data. To sort by a column outside the returned range, pass an array as the sort key instead of a number.
Variations
Sort by two columns
=SORT(A2:C, 1, TRUE, 2, FALSE)
Sorts by column 1 ascending, then by column 2 descending for ties.
Sort by a column outside the range
=SORT(A2:B, C2:C, TRUE)
The sort key can be its own array, letting you order A2:B by values in column C.
Top N with SORTN
=SORTN(A2:C, 5, 0, 2, FALSE)
SORTN returns just the top 5 rows by column 2, descending.
Sort a filtered result
=SORT(FILTER(A2:C, B2:B>0), 2, FALSE)
Filter first, then sort what survives.
Examples
| Scenario | Formula |
|---|---|
| Highest sales first | =SORT(A2:C, 3, FALSE) |
| Alphabetical by name | =SORT(A2:B, 1, TRUE) |
| Newest dates first | =SORT(A2:C, 1, FALSE) |
FAQ
How do I sort descending?
Pass FALSE as the direction, e.g. SORT(A2:C, 2, FALSE). TRUE means ascending.
Can I sort by more than one column?
Yes. Add extra column/direction pairs: SORT(A2:C, 1, TRUE, 2, FALSE) sorts by column 1, then breaks ties with column 2.
How do I get just the top few rows?
Use SORTN, e.g. SORTN(A2:C, 5, 0, 2, FALSE) returns the top 5 rows by column 2 descending.