How to Sort Data in Excel by One or More Columns
By ExcelReady TeamUpdated 6 min read
The short answer
To sort data in Excel by one column, click any cell in that column and choose Data > Sort A to Z or Sort Z to A. To sort by several columns, choose Data > Sort, pick the first column, then click Add Level for the next one. Click a single cell first so Excel keeps each row together.
Key takeaways
- Click one cell in the column, not the whole column, so Excel sorts entire rows together.
- Use Data > Sort and Add Level to sort by more than one column, such as Region then Sales.
- Tick My data has headers so the header row stays at the top.
- Numbers or dates stored as text sort in the wrong order; fix them before sorting.
- The SORT function gives a sorted copy and leaves the original data unchanged.
On this page+
To sort data in Excel, click one cell in the column you want to order by, then choose Data > Sort A to Z or Sort Z to A. To sort by more than one column, such as Region and then Sales, use the Sort dialog and add a level for each column. This guide covers both, plus the mistakes that scramble rows and the SORT function for a live, sorted copy.
How to sort data in Excel by one column#
A one-column sort takes one click. Excel works out where your list starts and ends and moves whole rows together.
Here is a small sales list:
| A | B | C | |
|---|---|---|---|
| 1 | Rep | Region | Sales |
| 2 | Priya | North | 48,200 |
| 3 | Tom | South | 39,150 |
| 4 | Ana | West | 61,400 |
| 5 | Kenji | North | 52,800 |
| 6 | Leila | East | 33,700 |
To put the biggest sales first:
- Click any cell in the Sales column, such as C3. Don't select the whole column.
- On the Data tab, click Sort Z to A (the button with Z above A). For numbers, Excel's menus call this Sort Largest to Smallest.
Ana's row (61,400) moves to the top, and her name and region move with her. The header row stays put because Excel detects it.
You'll find the same buttons under Home > Sort & Filter. On Windows, you can also use the ribbon keys: press Alt, then A, S, A for A to Z, or Alt, A, S, D for Z to A.
What the sort orders mean#
| Data type | Ascending (A to Z) | Descending (Z to A) |
|---|---|---|
| Text | A to Z | Z to A |
| Numbers | Smallest to largest | Largest to smallest |
| Dates | Oldest to newest | Newest to oldest |
Blank cells always go to the bottom, whichever direction you choose.
How to sort by multiple columns#
Use the Sort dialog when one column isn't enough. A common request is "group by region, and within each region put the biggest sales first".
- Click any cell in the list.
- Go to Data > Sort. (Windows ribbon keys: Alt, A, S, S.)
- Check that My data has headers is ticked.
- In Sort by, choose Region. Leave Sort On as Cell Values and Order as A to Z.
- Click Add Level. In Then by, choose Sales and set Order to Largest to Smallest.
- Click OK.
The East rows come first, then North, South and West. Inside North, Kenji (52,800) sits above Priya (48,200). The second level only matters for rows that tie on the first level.
You can add more levels the same way, use Delete Level to remove one, and use the arrow buttons to change which level runs first.
Sort by a custom order or by color#
Alphabetical isn't always the order you want. Months, weekdays and labels like Low, Medium, High need a custom order.
- Months and weekdays: in the Sort dialog, open Order, choose Custom List…, and pick the built-in January, February, March list (or the short Jan, Feb, Mar version).
- Your own order: in the same Custom List box, type your entries, such as
High, Medium, Low, click Add, then OK. - By color: set Sort On to Cell Color or Font Color, then pick the color to put on top. This works well after you highlight duplicates with conditional formatting.
To sort columns instead of rows, click Options… in the Sort dialog and choose Sort left to right.
Why does Excel sort my data wrong?#
Most sorting problems come from the data, not the button. Check these before you sort:
- You selected one column only. Excel shows a Sort Warning. Choose Expand the selection. If you choose Continue with the current selection, only that column moves and every row is scrambled.
- Blank rows or columns in the middle. Excel treats a fully blank row or column as the edge of the list, so part of your data isn't sorted. Delete the gaps, or select the whole list before sorting.
- Numbers stored as text. Text numbers sort like words, so
100comes before25. Look for green triangles and convert them first. - Dates stored as text. Text dates sort by their first characters, not by date. They often sit on the left of the cell, while real dates sit on the right.
- Merged cells. Excel refuses to sort a range where merged cells are different sizes. Unmerge them first.
- The header got sorted into the data. Tick My data has headers.
If something goes wrong, press Ctrl+Z (⌘Z on a Mac) at once. A good habit for important lists: add an ID column numbered 1, 2, 3 before you sort, so you can always sort by ID to get the original order back.
Sort with a formula: the SORT function#
The SORT function returns a sorted copy and leaves the original list as it is. It needs Excel 2021, Excel 2024 or Microsoft 365.
=SORT(A2:C8,3,-1)A2:C8is the data to sort (no headers).3sorts by the third column of that range, Sales.-1means descending, largest first. Use1for ascending.
Type it in one cell and the sorted list spills into the cells below and to the right. When a sale changes, the sorted copy updates by itself, which the Sort button can't do. To sort by two columns with a formula, use SORTBY, covered in our guide to SORT and SORTBY.
You can also sort a filtered result in one step. Put a FILTER function inside SORT:
=SORT(FILTER(A2:C8,B2:B8="North"),3,-1)This lists only the North reps, best seller first.
Sorting vs filtering#
Sorting changes the order of rows; filtering hides rows you don't need. They work well together: filter to one region, then sort by sales. Our guide to filtering data in Excel covers the filter buttons and the Ctrl+Shift+L shortcut that turns them on (⌘⇧F on a Mac).
If your list is an Excel table, the sort buttons are already on every header. Click the arrow next to a header and choose Sort A to Z or Sort Largest to Smallest.
Sorting in office tasks and job tests#
Sorting is one of the first things people check in a practical test. A typical task asks you to rank sales reps, list the oldest open tickets first, or group expenses by category. It's also everyday work in admin roles, as covered in Excel skills for admin and office jobs. Pair it with a drop-down list to keep categories consistent, and your sorts and filters will group everything correctly.
Practise it#
Try the exercise on this page to sort a sales list with a formula. Then practise the SORT function in a live spreadsheet, and practise filtering a table to combine sorting and filtering on real data.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
Your manager wants the best sellers first, without changing the original list. In E2, use SORT to sort A2:C8 by its 3rd column (Sales), largest first.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Sales | |||||
| 2 | ||||||
| 3 | ||||||
| 4 | ||||||
| 5 | ||||||
| 6 | ||||||
| 7 | ||||||
| 8 | ||||||
| 9 | ||||||
| 10 | ||||||
| 11 |
Tip: SORT(range, column number inside the range, -1 for largest first).
Practise this in a lesson
Frequently asked questions
How do I sort in Excel without mixing up the rows?
Click a single cell inside the column you want to sort by, not the column letter. Excel then selects the whole list and moves each row as one unit. If you see a Sort Warning, choose Expand the selection.
How do I sort by two columns in Excel?
Go to Data > Sort, choose the first column in Sort by, then click Add Level and choose the second column. Excel sorts by the first level and uses the second to order rows that tie.
Why is Excel sorting my numbers wrong?
The numbers are probably stored as text, so Excel sorts them like words: 100 comes before 25. Convert them to real numbers, then sort again.
Can I undo a sort in Excel?
Yes, press Ctrl+Z (⌘Z on a Mac) straight away. To get the original order back later, add a column numbered 1, 2, 3 before you sort, then sort by that column.
How do I sort by month name instead of alphabetically?
In the Sort dialog, open the Order list and choose Custom List, then pick the January, February, March list. Excel then sorts in calendar order.