logo
excelfunctions.org
bookmarks

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
AB
1NameSales
2Alice100
3Bob200
4Charlie50