Syntax

=SORTBY(array, by_array1, [sort_order1], ...)

Example

=SORTBY(A2:A20,B2:B20,-1)

When to Use It

Use SORTBY when the column you want to sort by isn't part of the range you want returned — e.g. sorting a list of names by a separate score column.