SORT Function: syntax, examples, mistakes and translation notes
Sorts a range or array.
Syntax
=SORT(array, [sort_index], [sort_order], [by_col])
Arguments
array
Range or array to sort.
sort_index
Row/column position inside the array used as the key.
sort_order
1 ascending or -1 descending.
by_col
FALSE sorts rows; TRUE sorts columns.
Worked examples
=SORT(A2:D100,2,1)
Sorts rows by the second column ascending.
=SORT(FILTER(A2:D100,D2:D100="Open"),3,-1)
Filters rows then sorts by the third returned column descending.
Practical tips
- sort_index is relative to the array passed to SORT.
- Combine SORT with FILTER for dynamic report views.
- Use SORTBY when you want to sort by an external range more explicitly.
Common mistakes
- Using a worksheet column number instead of the array-relative sort index.
- Expecting SORT to change the source range in place.
Related functions
Frequently asked questions
What does SORT do?
Sorts a range or array.
Why might a SORT formula return an unexpected result?
Using a worksheet column number instead of the array-relative sort index. Start by testing the smallest referenced range or condition independently before adding wrappers or fallbacks.
Check the complete formula
Function syntax is only one part of a working workbook. Paste the finished expression into the Formula Checker for structural warnings, the Formatter for readability or the Translator when a supported locale mapping is involved.
Testing note: examples are educational. Spreadsheet versions, locale settings, tables, named ranges and workbook data can change behavior, so validate important formulas with representative data.