Rows has joined Superhuman. Learn more. The Superhuman Privacy Policy and Terms will apply as of June 16.

SORT

Sort rows of an array or range by specified columns in ascending or descending order.

Parameter List

Syntax
SORT(rangesort_columnis_ascending
[sort_column2is_ascending2]
)
range

The data to be sorted. This is the array or range that contains the values you want to sort.

sort_column

The index of the column in range or a range outside of range containing the values by which to sort.

is_ascending

TRUE or FALSE indicating whether to sort sort_column in ascending order. FALSE sorts in descending order.

[optional] sort_column2

The index of the column in range or a range outside of range containing the values by which to sort.

Examples

SORT(A1:B3, 1, TRUE, 2, FALSE) returns [[10, "A"], [20, "B"], [30, "A"]], sorted by column 1 in ascending order.