Quick, clean, and to the point

Excel SORT Function

Excel SORT function

The Excel SORT function sorts the contents of a range or array. Values can be sorted by one or more columns. SORT returns a dynamic array of results.

Sorts range or array
Return value 
Sorted array
=SORT (array, [sort_index], [sort_order], [by_col])
  • array - Range or array to sort.
  • sort_index - [optional] Column index to use for sorting. Default is 1.
  • sort_order - [optional] 1 = Ascending, -1 = Descending. Default is ascending order.
  • by_col - [optional] TRUE = sort by column. FALSE = sort by row. Default is FALSE.
Usage notes 

The Excel SORT function extracts and sorts a list of unique values from a range. The result is a dynamic array of values. If this array is the final result (i.e. not handed off to another function) array values will "spill" onto the worksheet into a range that automatically updates when new uniques values are added or removed from the source range, or when source values change.

By default, the SORT function will sort values in ascending order using the first column. Use the optional arguments sort_index and sort_order to control which column to sort by, by what order (ascending or descending).


In the example shown, data includes in column B and scores in column B. The SORT formula in E5 is:

=SORT(B5:C14,2) // sort by scores in ascending order

The SORT function extracts all values, sorted in ascending order by score, and results "spill" into the range E5:F14.

To sort by score in descending order, set sort_order to -1 in a formula like this:

=SORT(B5:C14,2,-1) // sort by scores in descending order
SORT is a new function available in Excel 365 only.

Download 100+ Important Excel Functions

Get over 100 Excel Functions you should know in one handy PDF.