Excel – Sort Function

1 min read

Sort Function #

The SORT function rearranges the contents of a range or array in ascending or descending order. It’s dynamic—if your source data changes, the sorted result updates automatically.

This image shows a range than has had the =sort function applied to it.

Syntax #

=SORT(array, [sort_index], [sort_order], [by_col])

Argument #

Array –The range or array to sort. (Required)

Sort_index – The column (or row) number within array to sort by. Defaults to 1. (Optional)

Sort_order – 1 = ascending (default), -1 = descending. (Optional)

By_col –FALSE (default) = sort by rows; TRUE = sort by columns. (Optional)

How To Use It #

  1. Sort by the first column (ascending):
    =SORT(B3:E51)
    Sorts the entire B3:E51 area by the first column in ascending order.
  2. Sort by a specific column (ascending)
    =SORT(B3:E51, 2, 1)
    Sorts the range by the 2nd column (e.g., Salesperson) in ascending order.
  3. Sort by a specific column (descending)
    =SORT(B3:E51, 3, -1, FALSE)

    Sorts the range by the 3rd column (e.g., Amount) in descending order. FALSE confirms sorting by rows.
  4. Combine with other functions:
    =SORT(FILTER(B3:E51, B3:B51 = G3), 2, 1)

    First filters the table by a condition (e.g., item = “Laptop” in G3), then sorts the filtered result by column 2 in ascending order.

Why Use SORT? #

  • Non‑destructive — leaves your original data intact while showing the sorted output elsewhere.

  • Dynamic updates — results spill and update automatically when data changes.

  • Easily integrated with other dynamic functions like UNIQUE, FILTER, and SORTBY.

Was this article helpful?
Updated on January 12, 2026