How it works.
SORT orders a range or array by one or more columns in ascending or descending order. As a dynamic array formula, it automatically spills the sorted results into neighboring cells without altering your raw source data.
Formula syntax.
Standard Excel Notation=SORT(array, [sort_index], [sort_order], [by_col])[like_this] are optional; all other arguments are required.Formula arguments.
Every parameter accepted by the SORT function is detailed below.
The range or array to sort.
Example value:A2:B5Column index number to sort by (1-based, default is 1).
Default: 11 for Ascending (default), -1 for Descending.
Default: 1Simple example.
Step-by-Step ScenarioLeaderboard - Top Performing Products
Sort product table by sales volume in descending order.
| Product | Sales | Sorted Product | Sorted Sales |
|---|---|---|---|
| Product A | 150 | — | — |
| Product B | 450 | — | — |
| Product C | 200 | — | — |
=SORT(A2:B5, 2, -1)Evaluates SORT over the sample table cells, placing the verified output in cell D2.
Formula generator.
Full Generator WizardCustomize the argument fields below to generate a tailored SORT formula ready to paste directly into your worksheet.
=SORT()Expected result behavior.
Returns number 450 based on sample evaluation criteria and active cell references.
Best Practices
- Nest with UNIQUE: =SORT(UNIQUE(A2:A100)) generates a sorted alphabetical list of unique names.
Common Mistakes
- If any cell in the output spill range contains existing data, Excel returns a #SPILL! error.
Platform & version compatibility.
Verified platform compatibility matrix based on actual spreadsheet calculation engine specifications.
In Excel 2019, sort tables via Data > Sort or use helper columns with the RANK function.
Introduced in Excel 365 and Excel 2021. Not available in Excel 2019.
Fully supported in Google Sheets with identical arguments =SORT(range, sort_column, is_ascending).
Frequently asked questions.
Technical Q&ACan I use SORT across different worksheets in Excel?↓
Yes. You can reference cells located on other sheets by including the sheet name followed by an exclamation mark, for example: =SORT(Sheet2!A2:A10). If the sheet name contains spaces, enclose it in single quotes: ='Q1 Report'!A2:A10.
What is the most common reason for errors in SORT?↓
If any cell in the output spill range contains existing data, Excel returns a #SPILL! error.
Does SORT work identically in Google Sheets?↓
Yes, SORT is supported in both Microsoft Excel and Google Sheets with standard evaluation behavior.