ZonoTools

Excel SORT Function (Dynamic Order) – Examples & Practice

Practice the Excel SORT function online with an interactive grid, instant feedback, and clear formula help.

Instruction

Sort rows in A2:C6 by the 2nd column in descending order.

Formula Syntax

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

  • array: Data to sort.
  • [sort_index]: Column index within array (optional; defaults to 1).
  • [sort_order]: 1 ascending, -1 descending (implementation details vary—verify in Help).
  • [by_col]: Optional; sort columns instead of rows when TRUE.

What it does

SORT returns a sorted copy of an array or range, spilling the result in dynamic Excel. Use it whenever you need a formula-driven order that updates with data.

Excel SORT Function Examples

Sort by second column descending

=SORT(A2:C6, 2, -1)

Orders rows using column B inside the range (second column of A2:C6).

Default ascending on first column

=SORT(A2:C6)

Sorts by the first column ascending when sort arguments are omitted.

Sort filtered rows

=SORT(FILTER(A2:C6, C2:C6="North"), 3, 1)

Filters first, then sorts the result by the third column ascending.

dynamic-array-data.xlsx

ABC
1CategoryAmountRegion
2A120North
3B340South
4A560North
5C225West
6B90South
7Output

Input Formula

Need Help?

Tips

  • Pair with **FILTER** for “top exceptions sorted.”
  • Leave blank space for the spill grid.
  • Prefer **SORTBY** when you want to sort by a column not inside the returned columns.

SORT Function Use Cases

  • Live leaderboards beside raw tables
  • Consistent ordering before UNIQUE or lookups
  • Dashboard tables without manual resort
  • Teaching spill-based reporting
  • Cleaner pipelines than helper sort columns

Common mistakes - SORT function not working

  • Wrong sort_index after columns move
  • Expecting locale-aware text rules without testing
  • Mixing merged cells inside the spill area
  • Sorting whole columns on massive sheets
  • Forgetting FILTER when only a subset should be sorted

FAQ

Does SORT change the source data?

No. It returns a spilled sorted copy; original cells stay unchanged.

What is sort_index?

The column position inside the array to sort by (1 = first column of the array).

What values does sort_order use?

Typically 1 ascending (default) and -1 descending in modern Excel.

Can I sort by multiple columns?

Yes, using additional sort_index/sort_order pairs in supported versions.

Why #SPILL!?

The spill destination is blocked—clear cells or remove merges below the formula.

Comparison

Tool Live formula?
SORT Yes
Sort dialog One-time
SORTBY Adds explicit “by array” control

Example

=SORT(A2:C6, 2, -1)

Advanced examples

SORTBY for helper-free ordering

=SORTBY(A2:C6, B2:B6, -1) sorts the table by column B without choosing a sort_index number.

Tie-break columns

Stack multiple keys in SORTBY (when available) to break ties on name after sorting on score.

Related functions

FILTER and UNIQUE are the usual partners when sorted output feeds dashboards or validation lists.

When you must sort by a column you do not return, SORTBY (same family as SORT on supported builds) keeps formulas shorter than helper columns.