ExcelExcel 2021+
SORT function in Excel
Sorts the contents of a range or array
=SORT(array, [sort_index], [sort_order], [by_col])SORT syntax and parameters
Four arguments, one required.
- arrayarrayRequired
The range, or array to sort
- sort_indexnumberOptional
A number indicating the row or column to sort by
- sort_ordernumberOptional
A number indicating the desired sort order; 1 for ascending order (default), -1 for descending order
- by_colbooleanOptional
A logical value indicating the desired sort direction; FALSE to sort by row (default), TRUE to sort by column
SORT examples
Formulas you'll actually reuse.
Whole table by its third column, biggest deals first (-1 = descending):
=SORT(A2:C200, 3, -1)Filter then sort — the spilled result stays live as data changes:
=SORT(FILTER(A2:C200, C2:C200 > 1000), 3, -1)
SORT in Google Sheets
Same name — your formula ports as-is.
Try SORT in the playground
Edit the example — nothing to install.
Preloaded with the SORT formula from Example 1 — change anything and watch it respond.
Loading the editor…
Related functions
More ways Excel gets this done.
- FILTERFilters a range of data based on criteria you defineLookupGoogle Sheets
- XLOOKUPSearches a range or an array, and returns an item corresponding to the first match it finds. If a match doesn't exist, then XLOOKUP can return the closest (approximate) match.LookupGoogle Sheets
- XMATCHReturns the relative position of an item in an array or range of cells.LookupGoogle Sheets
- AVERAGEIFReturns the average (arithmetic mean) of all the cells in a range that meet a given criteriaStatisticalGoogle Sheets
- CELLReturns information about the formatting, location, or contents of a cellThis function is not available in Excel for the web.InfoGoogle Sheets
- CSCReturns the cosecant of an angleMathGoogle Sheets