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.
- 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.
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).
Examples
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
Download 200+ Excel Shortcuts
Get over 200 Excel shortcuts for Windows and Mac in one handy PDF.