Lookup and referenceExcel 2021

SORTBY

Reorder one array using values from one or more corresponding arrays.

Syntax

=SORTBY(array, by_array1, [sort_order1], [by_array2, sort_order2], …)

Worked example

Sort names by their paired scores, highest first.

=SORTBY({"Lee";"Ana";"Sam"},{30;20;40},-1)

Result Sam; Lee; Ana (three rows)

Microsoft documentation

Check the arguments, supported editions and behavior of this function in Microsoft’s reference.

Microsoft reference

Search ExcelTutor