EXCEL SORTBY FUNCTION

SORTBY sorts the elements of a range or array depending on the values in a related range or array.

Syntax :

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

Parameters :

  • The following parameter are :

array –

  • The array or range that will be sorted.

by array1 –

  • The array or range on which to sort.

[sort order1] –

  • The sort order to employ. If you’re climbing, you get a 1 and if you’re falling, you get a -1. Default is on the rise.

[by array2] –

  • The array or range on which to sort.

[sort order2] –

  • The sorting order to employ. If you’re climbing, you get a 1 and if you’re falling, you get a -1. Default is on the rise.

Step By Step Guide of SORTBY Function

Example :

Sort a table in ascending order by Area, then in decreasing order for each specific personality.

  • The by array parameters must be either one row or one column wide.
  • The size of all arguments must be the same.
  • The formula will return a #VALUE! error if the sort order input is not -1 or 1. If you don’t provide a sort order, Excel will use ascending order by default.

Related Functions

HLOOKUP Function

HLOOKUP Function

Explore Now

VLOOKUP Function

VLOOKUP Function

Explore Now

INDEX Function

INDEX Function

Explore Now

MATCH Function

MATCH Function

Explore Now

DATE Function

DATE Function

Explore Now

IF Function

IF Function

Explore Now

OR Function

OR Function

Explore Now

AND Function

AND Function

Explore Now

RANK Function

RANK Function

Explore Now

SUMIF Function

SUMIF Function

Explore Now

XIRR Function

XIRR Function

Explore Now

WORKDAYS Function

WORKDAYS Function

Explore Now