As of June 2026, Google Sheets ships 3 practical paths for this: =SORT, =SORTBY, and =QUERY. They're not interchangeable. Each has a specific job.
Formula Sort with =SORT: Syntax and Real Examples
=SORT takes an array and sorts it by one or more columns within that array.
=SORT(range, sort_column, is_ascending, [sort_column2], [is_ascending2], ...)
A real board-pack use case: you've got 47 SKUs on a Revenue tab with columns for SKU name (A), region (B), Q2 revenue (C), and gross margin % (D). You want a sorted view on your Summary tab without touching the source.
=SORT('Revenue'!A2:D48, 3, FALSE)
This outputs all 47 rows sorted by Q2 revenue descending. Revenue runs from $80K to $2.4M across SKUs - the sort puts your $2.4M line at the top where the board actually looks.
Need multi-key? Add columns:
=SORT('Revenue'!A2:D48, 2, TRUE, 3, FALSE)
Region ascending, then revenue descending within each region. Two arguments, no helper columns, no manual step before the next deck refresh.
One hard limit worth knowing: =SORT can only sort by columns inside the range you're sorting. If your sort key lives in a different column that you're not outputting, =SORT can't see it. That's where =SORTBY comes in.
SORTBY for Multi-Key Formula Sort
=SORTBY decouples the output range from the sort keys. The keys don't have to be in the output at all.
=SORTBY(range, sort_by_range1, sort_order1, [sort_by_range2], [sort_order2], ...)
Practical example: your Deals tab has deal name (A), stage (B), ARR (C), and close date (D), but you want an output that shows only name and ARR, sorted by close date ascending - without including close date in the output.
=SORTBY('Deals'!A2:C, 'Deals'!D2:D, 1)
The sort key (D2:D) drives the order, but the output only shows columns A through C. Clean for a board summary where you don't want to expose raw close dates.
SORTBY supports up to 64 sort key pairs, which is more than any real model needs. In practice, 3 keys covers almost every scenario: territory, then account tier, then ARR.
For a bank syndicate DCF where you're sorting comparable companies by EBITDA margin descending, then by EV/EBITDA ascending within each margin band:
=SORTBY(
'Comps'!A2:F30,
'Comps'!D2:D30, -1,
'Comps'!E2:E30, 1
)
Recalculation on a 5,000-row dataset runs around 40ms on a modern connection - fast enough that you won't notice it in a quarterly close workflow.
Combining Formula Sort with FILTER
This is where formula sorts earn their place in a real model. =FILTER reduces your dataset to matching rows; wrapping it in =SORT (or =SORTBY) orders the result. No helper columns, no intermediate range, no risk of the filter and sort getting out of sync.
=SORT(
FILTER(
'P&L'!A:E,
'P&L'!C:C >= Assumptions!$B$3,
'P&L'!D:D = Assumptions!$B$4
),
3, FALSE
)
This filters the P&L for rows where revenue date is on or after the start date in Assumptions B3 and region matches B4, then sorts the filtered output by column 3 (revenue) descending. Change the assumption cells and the sorted output updates automatically.
A contribution margin by SKU analysis looks nearly identical. Filter to in-scope SKUs, sort by contribution margin descending, output to your Waterfall tab:
=SORT(
FILTER(
'SKU Detail'!A2:G,
'SKU Detail'!B2:B = "Active",
'SKU Detail'!F2:F > 0
),
6, FALSE
)
This pulls only active SKUs with positive contribution margin, ranked highest to lowest. On a 47-SKU catalog generating $4.2M gross profit, you can see in 2 seconds which 8 SKUs account for 80% of that gross profit - no pivot, no manual filter step.
When to Use =QUERY Instead
=QUERY is SQL-lite inside Sheets. For sorting, it's more verbose than =SORT, but it lets you combine sorting with column selection, aggregation, and label renaming in a single formula.
=QUERY(
'Pipeline'!A:F,
"SELECT A, C, D WHERE B = 'Enterprise' ORDER BY D DESC LIMIT 20",
1
)
This pulls only the columns you want, filters by segment, sorts by deal value, and caps at 20 rows. According to Google's Sheets documentation (June 2026), =QUERY uses Google Visualization API query language, which means ORDER BY works on column letters (A, B, C) rather than numeric positions.
When to pick =QUERY over =SORT:
- You need column selection (not just reordering)
- You're aggregating (GROUP BY) and sorting the aggregates
- You want a row LIMIT on the output
- The filter logic is complex enough that SQL reads cleaner than nested FILTER arguments
When to stick with =SORT or =SORTBY:
- You want the full row output with no column surgery
- You need to sort by an external column not in your output
- You're already chaining with other array functions and QUERY would break the chain
The Architecture Problem Formula Sort Solves
The deeper issue isn't sorting mechanics - it's source integrity in a linked model.
In a three-statement model, your raw monthly P&L data sits on one tab. The cash flow statement references it. So does the FCFF schedule. So does the Returns Analysis. If someone hits Data → Sort on that source tab during a model review - which happens, especially with collaborators who aren't the model owner - every OFFSET, INDEX, and named range pointing into that tab now returns the wrong row.
A formula sort on a separate output tab breaks that dependency. The Revenue tab never moves. The sorted view on Summary or Board Pack updates itself. 23 downstream references stay clean.
This is also why cross-row formula breaks after sort in filtered ranges are such a common pain point: the Data → Sort path and formula-based references don't play nicely together. Formula sort sidesteps that class of problem entirely.
If you're building this kind of architecture and find yourself writing the same SORT/FILTER patterns repeatedly across tabs, ModelMonkey can generate the nested formula from a plain description of what you want - useful when you're three levels deep in SORTBY and FILTER and need the syntax right the first time.
Try ModelMonkey free for 14 days - it works in both Google Sheets and Excel.