SORTBY
Sorts the contents of a range or array based on the values in a corresponding range or array.
Lookup & ReferenceDynamic Arrays & LAMBDALookup & Matching EssentialsModern Excel Functions
What it does
Sorts a range based on another range.
Syntax
SORTBY(array, by_array1, [sort_order1], ...)
Arguments
array(range) β Range to sort.by_array1(range) β Range to sort by.sort_order1(number) β 1=Asc, -1=Desc.
Examples
Sort by Sales
Sort Names by Sales desc.
FORMULA
=SORTBY(A2:A4, B2:B4, -1)
RESULT
[Bob; Alice; Charlie]
SAMPLE DATA
| A | B | |
|---|---|---|
| 1 | Name | Sales |
| 2 | Alice | 100 |
| 3 | Bob | 200 |
| 4 | Charlie | 50 |