SORT Function
The SORT function is a lookup and reference function. It is used to sort a range of data or an array and to return the sorted array.
Please note that this is an array formula. To learn more, please read the Insert array formulas article.
The SORT function syntax is:
=SORT(array,[sort_index],[sort_order],[by_col])
where
array is the range of data to sort.
[sort_index] is an optional argument. A number identifying the column or the row to sort by.
[sort_order] is an optional argument. A number determining the sorting order:
- 1 or omitted for ascending order (by default),
- -1 for descending order,
[by_col] is an optional argument. A value indicating the sorting direction:
- FALSE or omitted for sorting by rows when your data is organized vertically.
- TRUE for sorting by columns when your data is organized horizontally.
To apply the SORT function,
- select the cell where you wish to display the result,
-
click the Insert function icon situated at the top toolbar,
or right-click within a selected cell and select the Insert Function option from the menu,
or click the icon situated at the formula bar,
- select the Lookup and Reference function group from the list,
- click the SORT function,
- enter the required arguments separating them by comma,
- press the Enter button.
The result will be displayed in the selected cell.

Return to previous page