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]
[sort_header]
)
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.

[optional] sort_header

TRUE or FALSE indicating whether to include the range's header in the sorting operation

Examples

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