Excel's SORT function gives you a sorted result built by a formula, so you don't have to re-run a manual sort. This guide covers the basic SORT formula, how to keep the result growing with your data, and how much room to leave for it.
Check that your Excel version has SORT
Microsoft's SORT function page lists these versions:
- Excel for Microsoft 365 (Windows and Mac)
- Excel 2024 and Excel 2021 (Windows and Mac)
- Excel for iPad, iPhone and Android tablets and phones
If your version isn't on that list, check Microsoft's page before building a workbook around the function.
The SORT syntax
Microsoft gives the syntax as:
=SORT(array,[sort_index],[sort_order],[by_col])
Only array is required. It is the range or array you want sorted. The other three arguments are optional. According to Microsoft, when by_col is FALSE or left out, Excel sorts by row, which is what you want for a normal list with records in rows.
Sort a range with one formula
- Pick an empty cell where the sorted result should start, with enough empty space to the right and below it.
- Type the formula, pointing it at your data. For example:
=SORT(A2:D20)
- Press Enter.
The result spills. Microsoft says Excel creates the appropriately sized range when you press Enter, and the returned array is the same shape as the array argument. So if you sort four columns, the result is four columns wide with the same number of rows as your source.
Make the sorted list grow with your data
Keep the source data in an Excel Table and refer to it with structured references. Microsoft's page says that if the source is an Excel Table and you use structured references, the result resizes as rows are added or removed.
Leave room for the spill
Because the result spills into a block the same shape as your source, the cells it needs should be empty. Put the formula somewhere with clear space to the right and below, such as a separate sheet, rather than squeezing it next to other data.
Sorting by a specific column with SORTBY
Excel also has a related SORTBY function for sorting by a chosen column. This guide doesn't cover its arguments; check Microsoft's own SORTBY page for the full argument list and which versions support it before you rely on it in a shared workbook.