Excel won't sort A to Z because the data is not set up the way the sort tool expects: the range usually contains merged cells, blank rows, hidden rows, numbers stored as text, or a mix of text and numbers in the same column. The quickest fix is to select the whole table (including headers), open Data > Sort, tick "My data has headers," and choose the column and order you actually want. If the Sort buttons on the ribbon are greyed out or the list comes back scrambled, the steps below walk through the real causes in order.

What You'll Need

  • Excel for Windows, Excel for Mac, or Excel for the web (menu labels can differ slightly by version, device and region).
  • A spreadsheet with the data you want to sort, ideally with one header row and no merged cells.
  • A backup copy of the sheet if the data matters — sorting overwrites the order and Undo is not always reliable after saving.

Step-by-Step

  1. Save a copy first. Use File > Save As and give the workbook a new name, or duplicate the sheet by right-clicking its tab and choosing Move or Copy. Sorting changes the row order permanently once you save.
  2. Click a single cell inside the data. Do not select the whole column or the whole sheet. Clicking one cell lets Excel detect the surrounding block of data automatically.
  3. Check for blank rows and blank columns. Excel treats a completely blank row as the end of the table, so anything below it will not be sorted with the rest. Delete or fill the blank row, or select the full range manually before sorting.
  4. Unmerge any merged cells. Select the range, then use Home > Merge & Center to toggle merging off. Merged cells are the single most common reason the A to Z button appears to do nothing or throws an error.
  5. Unhide rows and columns. Select the row or column headers, right-click, and choose Unhide. Hidden rows are skipped by some sort operations, which leaves the visible order looking wrong.
  6. Go to Data > Sort. On the ribbon, open the Sort dialog rather than clicking the A→Z button. The dialog shows exactly which column and order Excel will use, so you can catch a wrong setting before it scrambles your data.
  7. Tick "My data has headers." This keeps the header row at the top instead of sorting it into the list. If your first row is data, leave the box unticked.
  8. Set Sort by to the column you want, then choose A to Z. Under Order, pick A to Z for text or Smallest to Largest for numbers. Use Options > Sort left to right only if your data is laid out horizontally.
  9. Click OK and check the result. If the rows still look wrong, press Ctrl+Z (Cmd+Z on Mac) immediately to restore the previous order before doing anything else.
  10. Convert numbers stored as text. If a number column sorts as 1, 10, 2, the values are text. Select the column, use Data > Text to Columns and click Finish, or multiply the range by 1 in a helper column and paste the values back.
  11. Remove leading spaces. Text with a leading space sorts before text without one. Use Find & Replace with a space in Find what and nothing in Replace with, or wrap the column in TRIM() in a helper column.
  12. Turn off filters if the order keeps reverting. A filter that is still applied can make the list appear unsorted. Use Data > Filter to toggle it off, sort, then reapply the filter.

Common Mistakes

  • Selecting only one column before sorting. Excel then asks whether to expand the selection. Choosing "Continue with the current selection" sorts that column alone and breaks the row relationships.
  • Leaving merged cells in the header row. A merged title above the headers makes Excel treat the whole area as one table with no clear header, so the header gets sorted into the data.
  • Sorting a filtered list and assuming hidden rows moved too. Hidden rows stay where they are; only visible rows are reordered. Clear the filter first if you need a true sort.
  • Trusting the A→Z ribbon button when the active cell is outside the table. Excel may pick the wrong range. Click inside the data first, or use the full Sort dialog.
  • Forgetting that formulas referencing row positions will now point at different rows. If other sheets use direct cell references, check them after sorting.

Tips

  • Format your data as a table with Ctrl+T (Cmd+T on Mac). Tables expand automatically and keep headers out of the sort.
  • Use Data > Sort with multiple levels when you need a secondary sort, for example by Region then by Name.
  • Keep one data type per column. Mixing text and numbers in the same column produces the odd order that makes people think sorting is broken.
  • If you only need to view data in order, consider a filter or a pivot table instead of physically reordering rows.
  • Excel for the web supports the same Data > Sort dialog, but some legacy features behave differently; if a step is missing, open the file in the desktop app.

Troubleshooting

If the A to Z button is greyed out, the sheet is probably protected or the workbook is in a mode that blocks editing. Check Review > Unprotect Sheet, and confirm the file is not open read-only. If sorting throws "This operation requires the merged cells to be identically sized," unmerge the cells in the range and try again. If Excel says it cannot sort because of an array formula, select the range and use Data > Sort on the whole block rather than a single column. If the order looks correct but the header row moved into the list, undo, reopen Data > Sort and tick "My data has headers." If the list sorts but then reverts after you reopen the file, check whether the sheet is linked to an external query or a pivot source that refreshes on open. If nothing works, copy the values into a new sheet with Paste Special > Values, remove all formatting and merges, and sort there — this isolates formatting problems from data problems.

Frequently Asked Questions

Why is the A to Z button greyed out in Excel?

The sheet is usually protected, the workbook is read-only, or the selected cell is inside a pivot table or an array formula. Unprotect the sheet or sort the underlying data instead.

Why does Excel sort 1, 10, 2 instead of 1, 2, 10?

Those numbers are stored as text. Convert the column with Data > Text to Columns, or use a helper column with VALUE() and paste the results back as values.

Why did my header row get sorted into the data?

Excel did not recognise a header, often because of merged cells or a blank row above it. Undo, then use Data > Sort and tick "My data has headers."

Can I sort only part of a column?

Yes, but select the full rows you want to reorder, not just the cells in one column, or the row relationships will break. Sorting a partial range is best done in a copy of the sheet.

Does sorting in Excel for the web work the same way?

It uses the same Data > Sort dialog for basic sorts. Some advanced options and legacy features are only in the desktop app, so open the file there if a control is missing.

Why do hidden rows stay in place when I sort?

Excel sorts only visible rows when a filter or hidden rows are present. Clear the filter and unhide rows before sorting if you want the entire dataset reordered.