Advanced
Lookup & Reference
SORTBY
Sorts a range based on the values in a different range, rather than a column within the range itself.
Compatibility: Microsoft 365, Excel 2021+
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.