Excel like a finance pro.
The functions, VBA, and shortcuts a finance operator actually uses — curated, with CFO examples. Prefer them pre-built? Grab a ready-made model.
SORT / SORTBY
Dynamic arrays (Microsoft 365)Spill a range into sorted order — live, with no manual re-sort.
Difficulty
1What is it?
SORT returns the values of a range in sorted order, spilling the result into the cells below — and it re-sorts itself the moment the source data changes, unlike Data → Sort which is a one-time action. SORTBY is its companion: it sorts one range by the values in another (sort customers by revenue, line items by date) without moving the sort key into view. Microsoft 365 / Excel 2021+.
2What it looks like
SORT(array, [sort_index], [sort_order])- array
- The range to sort.
- [sort_index]
- Which column (or row) to sort by — 1 = first. Defaults to 1.
- [sort_order]
- 1 = ascending (default), -1 = descending.
3When you use it
- A live top-to-bottom ranking that re-sorts as numbers change.
- SORTBY(items, amounts, -1) for a biggest-first list (top customers, largest variances).
- Pair with UNIQUE for a clean, ordered dropdown source: SORT(UNIQUE(range)).
4See it in action
Change the inputs — the formula and result update live. Prefer the real thing? Download the Excel file and open it in Excel.
SORTBY orders the customers by their revenue and spills the result. Edit a number and watch the ranking re-sort.
=SORTBY(A2:A4, B2:B4, -1)Initech · $200,000| A | B | C | |
|---|---|---|---|
| 1 | Customer | Revenue | Result |
| 2 | Acme | Initech · $200,000 | |
| 3 | Globex | Acme · $120,000 | |
| 4 | Initech | Globex · $80,000 |
The lime cell holds the formula — click it (or any cell) to see its contents in the bar above, just like Excel. Edit the blue cells to watch it recompute.
5Common errors
#SPILL!Something is blocking the cells the result needs to fill.Fix: Clear the cells below/right of the formula.
#VALUE!sort_index points outside the array.Fix: Use a column number within the array's width (1-based).
#NAME?You're on a version without dynamic arrays.Fix: SORT/SORTBY need Microsoft 365 or Excel 2021 — use Data → Sort otherwise.
6Better functions & alternatives
Want SORT / SORTBY already wired into a model? Wauvel's free tools download as branded, formula-driven Excel.
Learn the moves here — or let Wauvel run them on your numbers.
Get my free report →