Category: FUNCTION | Updated: 2026-11-20

How to Use the SORT Function in Google Sheets | Automatically Sort While Preserving Source Data

How to Use the SORT Function

The SORT function outputs a new table sorted in ascending or descending order based on one or more specified columns. It is ideal for automatically generating rankings or date-ordered lists without altering the order of your source data.

Syntax

=SORT(range, sort_column, is_ascending, [sort_column2, is_ascending2, ...])
  • range: The cell range of data to sort (required).
  • sort_column: The column number (counting from the left edge of range) to sort by (required).
  • is_ascending: Specify TRUE (or 1) for ascending order, or FALSE (or 0) for descending order (required).
  • sort_column2, is_ascending2, …: Additional tie-breaker columns and sort orders when values in the primary sort column are equal (optional).

Table Example

Here is an example of sorting the "Test Results" in Columns A–C by the 3rd column (Score) in descending order (highest first) and displaying the result starting at cell E2.

Row Column A (Name) Column B (Class) Column C (Score) Column D Column E (Ranked Name) Column F (Class) Column G (Score)
1 Name Class Score Name Class Score
2 Tanaka Class A 78 =SORT(A2:C4, 3, FALSE) (Auto-spilled) (Auto-spilled)
3 Sato Class B 95 Tanaka Class A 78
4 Suzuki Class A 86 Suzuki Class A 86
  • Formula in cell E2: =SORT(A2:C4, 3, FALSE)
  • Result: The rows automatically spill in descending order of score: Sato (95), Suzuki (86), and Tanaka (78).

Common Errors and Notes

  • Specifying a column number outside range (#VALUE! error): If range only has 3 columns (A2:C4) and you set sort_column to 4 or higher, an error occurs.
  • Including the header row in range: Including the header row like A1:C4 causes header labels (such as "Score") to be sorted along with the data. Always specify only the data rows (A2:C4).
  • Spill destination overwrite conflict (#REF! error): If any cell in the area where the sorted results spill already contains data, a #REF! error occurs.

Frequently Asked Questions

Q. How do I specify "ascending" and "descending" order in the SORT function?

A. Specify "TRUE" (or "1") for the 3rd argument (is_ascending) for ascending order (smallest to largest, A to Z), or "FALSE" (or "0") for descending order (largest to smallest, Z to A).

Q. Can I sort the results extracted by the FILTER function using SORT?

A. Yes. Wrapping FILTER inside SORT, like =SORT(FILTER(A2:C10, B2:B10="Sales"), 3, FALSE), lets you automatically sort filtered data by sales or other columns.