As of June 2026, SORT and its companion SORTBY are part of Google Sheets' dynamic array engine, introduced in the 2019 formula overhaul. Both spill results into as many cells as needed with no manual range management required.
Función ORDENAR en Google Sheets: Syntax and Arguments
=SORT(range, sort_column, is_ascending, [sort_column2, is_ascending2, ...])
- range: the data to sort - can reference another tab entirely
- sort_column: column index within the range (1-based)
- is_ascending: TRUE for A→Z or low→high, FALSE for high→low
- Optional column/direction pairs let you sort by multiple criteria
Sorting a 12-segment table from your P&L tab by LTM revenue descending:
=SORT('P&L'!B4:E15, 3, FALSE)
Column 3 in that range is LTM Revenue. The result lands wherever you put the formula and refreshes live when the source changes.
SORTBY: Sort by a Column Outside Your Output Range
SORTBY separates what you're sorting from what you're sorting by:
=SORTBY(range, sort_by_array1, is_ascending1, [sort_by_array2, is_ascending2, ...])
The sort_by_array doesn't have to be inside range. Sort a segment contribution margin table by EBITDA margin, where the margin column lives in column F but you only want columns A through D in the output:
=SORTBY('Segments'!A4:D15, 'Segments'!F4:F15, FALSE)
Break ties by adding a second sort key - EBITDA margin descending, then LTM revenue descending:
=SORTBY(
'Segments'!A4:D15,
'Segments'!F4:F15, FALSE,
'Segments'!C4:C15, FALSE
)
SORT vs SORTBY vs Manual Sort: Which to Use
| Method | Source stays unchanged | Dynamic updates | Sort by outside column | Multi-column sort |
|---|---|---|---|---|
| Manual sort (Data menu) | No | No | N/A | Yes |
| SORT | Yes | Yes | No (col must be in range) | Yes |
| SORTBY | Yes | Yes | Yes | Yes |
Manual sort is fine for a one-off printout. The moment your data is linked across tabs or refreshed by a feed, you need SORT or SORTBY. A manual sort on linked data is how you present stale comps to a syndicate desk.
Función ORDENAR en Google Sheets + FILTER: Ranked Segment Views
The most useful FP&A pattern: combine SORTBY with FILTER to show only the segments that clear a threshold, ranked by performance.
This formula pulls every segment above $500K LTM revenue from the P&L tab and ranks them by gross margin descending:
=SORT(
FILTER(
'P&L'!B4:E15,
'P&L'!D4:D15 >= 500000
),
3, FALSE
)
Column 3 in the filtered output is gross margin. The top segment in a real model might carry $4.2M in LTM revenue at a 38.5% gross margin. When a segment crosses the $500K threshold it appears automatically. When it drops below, it disappears. No helper columns, no manual updates, no stale board pack.
Wrap in IFERROR if any source cells might be blank:
=IFERROR(
SORT(
FILTER('Segments'!A4:D15, 'Segments'!C4:C15 >= 0),
3, FALSE
),
"No qualifying segments"
)
Multi-Tab SORT in a Returns Analysis or Comps Table
A bank syndicate DCF with 14 comparable companies - sort the comps table by EV/EBITDA ascending and leave the source data untouched:
=SORTBY(
'Comps'!A3:F16,
'Comps'!E3:E16, TRUE
)
Your median multiple formula in the same tab stays stable:
=MEDIAN('Comps'!E3:E16)
Because SORTBY outputs to a spill range, the source in Comps!E3:E16 is never reordered. The median doesn't drift when someone changes the display sort. That's not possible with Data > Sort.
For an LBO with 7 scenarios ranked by IRR best to worst:
=SORTBY(
'Scenarios'!A2:D8,
'Scenarios'!D2:D8, FALSE
)
When you adjust entry multiple or leverage assumptions, the ranking updates instantly. The scenario at 14.2x EBITDA entry at 6x leverage re-slots itself without any manual intervention.
One Limitation That Catches People Off Guard
SORT and SORTBY spill into a contiguous output range. If any cell in that range is occupied, you get #SPILL!. In a dense model with tight row spacing, this shows up unexpectedly. The fix is simple: either clear the cells below and to the right of where SORT lands, or route sorted output to a dedicated display tab.
According to Google's Sheets function documentation, SORT and SORTBY support up to 2 billion cells in a single formula result, well above Google Sheets' own 10-million-cell-per-spreadsheet cap. The practical constraint is the spreadsheet limit, not the function.
Where ModelMonkey Fits
If your source data comes from HubSpot, Stripe, or a Postgres database, ModelMonkey pulls it into a Sheets tab and keeps it refreshed on a schedule. Your SORT and SORTBY formulas reference that tab, and the ranked output updates automatically when the underlying data does. The pipeline from raw data to ranked view runs without manual exports or copy-paste steps.
Try ModelMonkey free for 14 days - it works in both Google Sheets and Excel.