ExcelFormulas logoExcelFormulas.
Ask AI
Dynamic ArraysVerified QA Tested

SORT.

Sorts the contents of a range or array dynamically.

Category: Dynamic Arrays
ExcelExcel 365Excel 2021Google Sheets

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])
Tip:Arguments wrapped in square brackets [like_this] are optional; all other arguments are required.

Formula arguments.

Every parameter accepted by the SORT function is detailed below.

arrayRequired

The range or array to sort.

Example value: A2:B5
sort_indexOptional

Column index number to sort by (1-based, default is 1).

Default: 1
sort_orderOptional

1 for Ascending (default), -1 for Descending.

Default: 1

Simple example.

Step-by-Step Scenario

Leaderboard - Top Performing Products

Sort product table by sales volume in descending order.

ProductSalesSorted ProductSorted Sales
Product A150——
Product B450——
Product C200——
Applied Formula
=SORT(A2:B5, 2, -1)
Expected Result:450

Evaluates SORT over the sample table cells, placing the verified output in cell D2.

Formula generator.

Full Generator Wizard

Customize the argument fields below to generate a tailored SORT formula ready to paste directly into your worksheet.

Generated FormulaReady to copy

Expected result behavior.

Returns number 450 based on sample evaluation criteria and active cell references.

Sample Output:450
Output Type:Numeric (Double/Integer)

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.
Compatibility Database

Platform & version compatibility.

Verified platform compatibility matrix based on actual spreadsheet calculation engine specifications.

Excel✓
Supported
Excel 365✓
Supported
Excel 2021✓
Supported
Excel 2019✕
No
Google Sheets✓
Supported
Microsoft Excel History & Version Availability

Introduced in Excel 365 and Excel 2021. Not available in Excel 2019.

Google Sheets Compatibility Notes

Fully supported in Google Sheets with identical arguments =SORT(range, sort_column, is_ascending).

Frequently asked questions.

Technical Q&A
Can 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.