All functions / Dynamic arrays
SORT
Sorts a range. The result spills.
Syntax
=SORT(array, [sort_index], [sort_order], [by_col])
Arguments
array: The data to sort.sort_index(optional): Which column to sort by (default 1).sort_order(optional): 1 ascending (default) or -1 descending.by_col(optional): TRUE to sort columns instead of rows.
Example
=SORT(A2:B20, 2, -1) → Rows sorted by column 2, largest first