Syntax
| Parameter | Description |
|---|---|
| array | Parameter of the SORT function. |
| [sort_index] | (Optional.) Parameter of the SORT function. |
| [sort_order] | (Optional.) Parameter of the SORT function. |
| [by_col] | (Optional.) Parameter of the SORT function. |
Examples
Sort names alphabetically
=SORT(A2:B20, 1, 1)
Sort sales descending
=SORT(A2:C50, 3, -1)
Sort by multiple columns
=SORT(SORT(A2:D100, 2, 1), 1, 1)
Common Errors
The sort_index is zero or exceeds the number of columns (or rows if sorting by column).
The destination cells where results would spill are not empty.
Tips
Unlike the Sort button in the toolbar, SORT creates a sorted copy in a new location. Your original data stays untouched and the sorted view updates automatically.
The sort_order argument uses 1 for ascending and -1 for descending. This is different from TRUE/FALSE used in some older functions.
Use =SORT(FILTER(A2:C100, C2:C100>1000), 3, -1) to first filter rows, then sort the results. This creates a powerful dynamic dashboard view.
Try SORT in Viztab
Import your data and use SORT with 370+ other formulas. No signup required.
Open Viztab