How to Sort Info in Excel: Step-by-Step Guide
In this article
To sort information in Excel, select any cell inside your data range, go to the Data tab, click Sort (or Sort A to Z / Sort Z to A for a quick sort), choose the column and order you want, and confirm. Excel automatically expands the selection to include all adjacent columns so rows stay intact. The exact button labels can differ slightly by Excel version and by whether you are on Windows, Mac, or the web app, but the Data tab workflow is the same.
What You'll Need
- Excel for Windows, Excel for Mac, or Excel for the web (the steps below work in all three; the web app has fewer sort options than the desktop versions).
- A worksheet with data laid out in columns, ideally with one header row at the top and no completely blank rows or columns inside the range.
- Nothing else — no add-ins or special formatting are required.
Step-by-Step
- Make a backup first. Sorting changes the order of rows permanently in the file. If the data matters, copy the sheet (right-click the sheet tab and choose Move or Copy, tick Create a copy) before you start, so you can compare or revert.
- Remove blank rows and columns inside your data. Excel treats a fully blank row or column as the edge of the range. If there is a gap, only part of your table gets sorted and rows can end up mismatched. Delete or fill the gaps first.
- Click a single cell inside the data. Do not select the whole sheet and do not select only one column unless you deliberately want to sort that column alone. Clicking one cell lets Excel detect the surrounding table automatically.
- Check that Excel recognises your headers. Go to Data and click Sort. In the dialog, make sure My data has headers is ticked if your first row contains column names. If it is unticked, Excel will treat the header as data and sort it into the middle of your list.
- Choose the column to sort by. In the Sort by dropdown, pick the column name (or Column A, B, C if you have no headers). In the Order dropdown, choose A to Z, Z to A, Smallest to Largest, or Largest to Smallest. Text sorts alphabetically; numbers sort by value; dates sort chronologically.
- Add a second level if you need a tie-breaker. Click Add Level, then set Then by to another column. For example, sort by Department A to Z, then by Last Name A to Z. This keeps groups together and orders names within each group.
- Decide on case sensitivity and orientation. Click Options in the Sort dialog if you need a case-sensitive sort (uppercase before lowercase) or need to sort left to right instead of top to bottom. Most everyday sorts do not need either option.
- Click OK. Excel reorders the rows and keeps each row's values together. Check the first and last few rows to confirm the header stayed at the top and that related columns still line up.
- For a quick one-column sort, use the ribbon buttons. With a cell selected in the column, click Sort A to Z or Sort Z to A on the Data tab. Excel will ask whether to expand the selection; choose Expand the selection so the whole row moves together.
- To sort by cell colour, font colour, or icon, open the Sort dialog, set Sort by to the relevant column, and change Sort On from Values to Cell Color, Font Color, or Cell Icon. This is useful for flagging overdue items you have highlighted.
- Save the file. Sorting is not reversible with Undo once you close and reopen the file, so save only after you have checked the result.
Common Mistakes
- Sorting a single column instead of the whole table. If you select one column and click Sort A to Z, Excel may sort only that column and leave the other columns in place, scrambling which value belongs to which row. Always expand the selection or click one cell inside the table.
- Leaving blank rows or columns inside the data. Excel stops at the gap, so only part of the table is sorted. Remove the gaps first.
- Forgetting to tick "My data has headers". Your header row gets sorted into the data as if it were a normal value.
- Sorting numbers stored as text. Values like "10" and "9" may sort as 10 before 9 because text is compared character by character. Convert them to numbers first (use Text to Columns or multiply by 1 in a helper column).
- Sorting merged cells. Merged cells across rows break sorting. Unmerge them before you sort.
- Expecting formulas to follow their rows. Relative references usually move with the row, but absolute references and lookups can point elsewhere after a sort. Check key formulas afterwards.
Tips
- Format your range as a table (select it and press Ctrl+T on Windows or Cmd+T on Mac) so future sorts and filters apply to the whole table automatically.
- Use Custom Sort when you need a non-alphabetical order, such as High, Medium, Low. In the Sort dialog, set Order to Custom List and enter your sequence.
- Sort before you add subtotals or charts; re-sorting afterwards can break the layout.
- If you only want to see certain rows without changing their order, use Filter (Data > Filter) instead of sorting.
- Keep a helper column with a unique ID (such as an invoice number) so you can always restore the original order by sorting on that column.
Troubleshooting
- Only some rows moved. A blank row or column split the range. Delete the gaps, then re-sort.
- The header row ended up in the middle. Undo (Ctrl+Z or Cmd+Z), reopen Sort, and tick My data has headers.
- Numbers sort oddly (1, 10, 2). They are stored as text. Select the column, use Data > Text to Columns and finish, or convert with a formula, then sort again.
- Dates sort as text. Check the cell format; if dates are left-aligned they are probably text. Convert them to real dates before sorting.
- Sort options are greyed out. You may be in a protected sheet, a shared workbook with restrictions, or editing a cell rather than the sheet. Unprotect the sheet (Review > Unprotect Sheet) if you have permission, or press Esc to leave edit mode.
- Rows look misaligned after sorting. Undo immediately, then re-sort with the whole range selected or with the table formatted properly.
Frequently Asked Questions
Does sorting in Excel keep rows together?
Yes, if Excel recognises the full range. Click one cell inside the data and use Data > Sort, or choose Expand the selection when prompted. Selecting a single column and sorting it alone is what breaks rows apart.
Can I undo a sort?
Yes, with Undo (Ctrl+Z on Windows, Cmd+Z on Mac) before you close the file. After saving and reopening, the previous order is gone unless you kept a copy or a unique ID column to re-sort by.
How do I sort by more than one column?
Open Data > Sort, set the first column under Sort by, then click Add Level and set the next column under Then by. Repeat for each tie-breaker.
Why does Excel sort 10 before 2?
Those values are stored as text, so Excel compares them character by character. Convert the column to numbers, then sort again.
Can I sort by colour?
Yes. In the Sort dialog, change Sort On from Values to Cell Color, Font Color, or Cell Icon, then choose the colour and whether it goes on top or bottom.
Does sorting work the same in Excel for the web?
Basic A to Z and Z to A sorting and multi-level sort are available, but some desktop options such as custom lists and certain colour sorts may be limited. For full control, use the desktop app.