Lookup & Reference Modern

SORT

Returns a range sorted by one or more columns.

Available in Microsoft 365 · Excel 2024 · Excel 2021 · Excel for the web. Not in 2019/2016.

Syntax

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

What it returns

A spilled array of the sorted data.

Arguments

ArgumentRequiredDescription
array Yes The range to sort.
sort_index No Which column (or row) to sort by (default 1).
sort_order No 1 = ascending (default), -1 = descending.
by_col No FALSE = sort rows (default), TRUE = sort columns.

Example

Source
ABC
1RegionSales
2North1200
3South800
4East1500
5West600
6
Result
ABC
1RegionSales
2East1500
3North1200
4South800
5West600
6
=SORT(A2:B5, 2, -1)

Important to know

Spills into multiple cells.

Returns a sorted copy — the source is unchanged.

Use SORTBY to sort by a column you don't display.

365 / 2021+ only.

Related functions

Related learning

No MEE lesson covers this function yet.