Spreadsheet formulas explained, side by side

SORT Function in Excel, Google Sheets, Airtable & Notion

SORT returns a sorted copy of a range and spills it, leaving the original data untouched. You choose the column to sort by and the direction; the result updates when the data changes.

Syntax in each app

AppSupportSyntax & notes
Excel✔ Built inSORT(array, [sort_index], [sort_order], [by_col])
Excel 2021 / Microsoft 365
sort_order is 1 (ascending) or −1 (descending). SORTBY(array, by_array, [order]) sorts by a column outside the array.
Google Sheets✔ Built inSORT(range, sort_column, is_ascending, [sort_column2, is_ascending2, ...])
Different from Excel: direction is TRUE/FALSE, and you can add more column/direction pairs.
Airtable✘ Not available—
Formulas cannot sort records. Sort a view instead; linked record, lookup and rollup fields keep the order the records were linked in.
Notion≈ Workaroundlist.sort()
Sorts a single list in ascending order, e.g. prop("Scores").sort(). It sorts values, not whole rows; to sort pages, sort the database view.
Try SORT with your own values
One item per line
One value per line, or separate with commas
Result (as Excel & Google Sheets return it)
Ann | 92, Cara | 88, Eli | 81, Ben | 75, Dev | 64 Spills into 5 cells
Your formula, ready to paste
Excel=SORT(A2:B6, 2, -1) open excel.new ↗
Google Sheets=SORT(A2:B6, 2, FALSE) open sheets.new ↗
Airtable✘ No equivalent. Formulas cannot sort records. Sort a view instead; linked record, lookup and rollup fields keep the order the records were linked in.
Notion
workaround
[92, 75, 88, 64, 81].sort()

Excel & Sheets use cell ranges. Paste this sample data into cell A1 of a blank sheet, then paste the formula into any empty cell.

Name	Score
Ann	92
Ben	75
Cara	88
Dev	64
Eli	81

Notion's formula sorts only the chosen column, and always ascending.

Arguments

ArgumentWhat it means
arrayThe range to sort, e.g. A2:B6.
[sort_index] optionalWhich column of the range to sort by (1 = first). Default 1.
[sort_order] optionalExcel: 1 ascending (default) or −1 descending. Google Sheets: TRUE ascending or FALSE descending.
[by_col] optionalExcel only: TRUE sorts columns instead of rows.

Examples

FormulaResultWhyCopy
=SORT(A2:B6, 2, -1)Ann | 92, Cara | 88, Eli | 81, Ben | 75, Dev | 64Tester data: a leaderboard, highest score first.
=SORT(A2:B6, 2, FALSE)Same as aboveThe Google Sheets way to write descending.
=SORT(A2:A6)Ann, Ben, Cara, Dev, EliOne column, A to Z.
=SORTBY(A2:A6, B2:B6, -1)Ann, Cara, Eli, Ben, DevExcel only: names ordered by a column that is not returned.

Examples use Excel / Google Sheets syntax unless noted.

How SORT works

SORT gives you a sorted copy of your data that stays live: change a score and the leaderboard re-orders itself, without touching the source range. That makes it ideal for dashboards, top-N lists (=TAKE(SORT(A2:B100, 2, -1), 5) in Excel 365) and sorted drop-down sources. The result spills, so leave room below and to the right or you get #SPILL!.

The arguments differ between apps, which is a common copy-paste bug. Excel uses a column number and 1 / -1 for the direction; Google Sheets uses a column number and TRUE / FALSE, and lets you add more column-direction pairs for tie-breaks. In Excel, sort on several columns with array constants, SORT(A2:C20, {2,1}, {-1,1}), or use SORTBY. Text sorts without regard to case, numbers come before text, and blank cells go to the end (and show as 0 in the result).

SORT needs Excel 2021 or Microsoft 365. Airtable cannot sort with a formula; sort the view instead. Notion's .sort() sorts the values of a list in ascending order, which is enough for a list of numbers or names but cannot re-order whole rows.

Frequently Asked Questions

How do I sort in descending order?
Excel: =SORT(A2:B20, 2, -1). Google Sheets: =SORT(A2:B20, 2, FALSE).
How do I get the top 3?
Excel 365: =TAKE(SORT(A2:B20, 2, -1), 3). Google Sheets: =ARRAY_CONSTRAIN(SORT(A2:B20, 2, FALSE), 3, 2). For just the values, LARGE works everywhere.

Part of the Lookup & Reference functions. Results in the tester follow Excel and Google Sheets behaviour; always double-check important work in your own file.