What the video covers
Show how to build a SORTBY formula that returns a sorted array from existing worksheet data; does not cover older Excel versions that lack dynamic arrays or alternative manual sort commands.
Watch the video on YouTubeStep-by-step instructions
- Prepare your data
Make sure the data you want to sort is organized in contiguous columns (a table or a simple range) and that the column you want to sort by lines up with the sort range. - Select output cell
Click the cell where you want the sorted results to appear. The SORTBY results will spill into adjacent cells as needed. - Start the SORTBY formula
Type =SORTBY( then select the range you want returned in sorted order (the primary result range). - Specify the sort key and order
After a comma, select the range to sort by (the key). Add another comma and enter 1 for ascending or -1 for descending. Example: =SORTBY(A2:C20, B2:B20, 1) - Add additional sort levels (optional)
To sort by more than one column, append additional key/order pairs separated by commas: =SORTBY(result_range, key1, order1, key2, order2, …). - Confirm and verify dynamic behavior
Close the parentheses and press Enter. Verify the spilled range shows the sorted data and that changing the source updates the output automatically.
Watch the video
Play tutorial
Why it matters
SORTBY lets you create live, non-destructive sorts for dashboards and reports. It sorts output separately from the source so you can keep the original dataset intact while presenting ordered results that update automatically.
Check your result
After entering the SORTBY formula, Excel should display a sorted block (a spilled array). The source data remains unchanged. Changing values in the source should immediately update the sorted results.
Troubleshooting
If the result shows a #SPILL! error, check for any cell blocking the spill range. If you get a #VALUE! or unexpected order, ensure the sort ranges have matching dimensions (same number of rows). For descending order, use -1. If SORTBY isn't available, your Excel version may not support dynamic array functions.