SORT: reorder a view without moving the source
A SORT formula creates another view of the same data. The crucial point is to sort whole records together, so names, IDs and amounts stay matched.
Formula syntax
=SORT(array, [sort_index], [sort_order], [by_col])
What goes into it
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.
A quick example first
=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.
Rank a small order list by amount
Enter these rows in A1:C4 and put the output formula away from the source.
| Row | A: Order | B: Region | C: Amount |
|---|---|---|---|
| 2 | O-11 | East | 120 |
| 3 | O-12 | West | 80 |
| 4 | O-13 | East | 200 |
| Formula | Expected result / interpretation |
|---|---|
| =SORT(A2:C4,3,-1) | Order sequence O-13, O-11, O-12 |
| =SORT(A2:C4,3,1) | Order sequence O-12, O-11, O-13 |
The sort index 3 means the third column within A2:C4. The -1 requests descending order. All columns move together in the returned array, so order IDs stay paired with amounts. Sorting the amount column alone would lose those relationships.
Before you copy this into a real sheet
Use a dynamic-array version of Excel and leave room for the result to spill. SORT returns a separate view and does not rearrange the original rows. When equal amounts need a deterministic secondary order, use SORTBY with another key instead of relying on an unstated tie-break. Google Sheets SORT requires its own syntax. If the source grows, use a table reference or deliberately extend the bounded range; the fixed A2:C4 example will not include a newly added row 5.
Useful habits
- 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.
Where people get caught out
- Using a worksheet column number instead of the array-relative sort index.
- Expecting SORT to change the source range in place.
Other functions worth a look
A detail worth remembering
The sort index belongs to the array you provided. A source column letter by itself does not tell you which index the formula should use.
Reference and examples
The examples above use small, invented datasets and English-language formula names. Check your Excel version and argument separator against the official Excel function reference if a formula behaves differently on your computer.