SORTBY function

The SORTBY function is one of the lookup and reference functions. It is used to sort a range of data or an array based on the values in a corresponding range or array.

Syntax

SORTBY(array, by_array, [sort_order], ...)

The SORTBY function has the following arguments:

ArgumentDescription
arrayA range of data to sort.
by_arrayAn array or range used for sorting.
sort_orderAn optional argument. A number determining the sorting order. The possible values are listed in the table below.

The sort_order argument can be one of the following:

Numeric valueMeaning
1 or omittedAscending order (by default)
-1Descending order
Notes

Please note that this is an array formula. To learn more, please read the Insert array formulas article.

How to apply the SORTBY function.

Examples

The figure below displays the result returned by the SORTBY function.

SORTBY Function

Host ONLYOFFICE Docs on your own server or use it in the cloud

Article with the tag:
Browse all tags