Excel Not Letting You Sort? Fix It Step by Step
In this article
Excel usually refuses to sort for one of three reasons: the selected range is ambiguous (Excel cannot tell whether the top row is a header), the data contains merged cells, or the sheet or workbook is protected. Click any single cell inside your data, go to Data > Sort, tick My data has headers if your first row holds column names, choose a column in the Sort by list, and click OK. That fixes the majority of cases. The rest of this guide walks through each cause in order, so you can stop as soon as sorting starts working.
One note before you begin: menu names and the exact layout of dialog boxes vary slightly between Excel versions, platforms and regions. Steps below describe Excel for Windows and Mac desktop; where the browser or mobile version differs, that is called out.
What You'll Need
- A spreadsheet open in Excel with data you want to reorder.
- Access to unprotect the sheet or workbook, if a password was set by whoever made it (you will need that password - it cannot be bypassed).
- A backup copy of the file, or at least a recent save, because sorting rearranges data permanently and undo is limited to the current session.
- A moment to check whether any other cells elsewhere on the sheet reference the rows you are about to move.
Step-by-Step
- Check whether the sheet is protected. Look at the ribbon: if most buttons are greyed out and the Review tab has an Unprotect Sheet button, protection is on. Click Unprotect Sheet and enter the password. If the whole workbook is protected, you will see Unprotect Workbook instead. Sorting is blocked completely while protection is active.
- Look for merged cells in your range. Select the data, then open Home and look at the Merge & Center button - if it is highlighted, merged cells exist. Click Merge & Center to unmerge them (the data stays in the top-left cell of each merged block, and the rest is cleared). Sorting any range containing merged cells is refused with an error about cells of different sizes.
- Click a single cell inside the data - not a whole column header, not a multi-cell selection. A single cell lets Excel detect the surrounding block automatically.
- Go to Data > Sort. In the dialog, look at the top-right checkbox: My data has headers. Tick it if your first row contains column names, so Excel treats that row as labels rather than sorting it into the data. Untick it if your first row is real data.
- Set the sort key. In the Sort by dropdown, pick the column you want to order by, then choose Sort On (Cell Values, Cell Color, Font Color or Conditional Formatting Icon) and Order (A to Z, Z to A, or a custom list for things like days and months).
- Add levels if you need a tiebreaker. Click Add Level to sort by a second column when the first has duplicates - for example, sort by Department, then by Last Name within each department.
- Click OK. If Excel warns that it found numbers stored as text, choose Sort anything that looks like a number, as a number only when those cells really are values; choose the text option if codes such as postcodes or part numbers must keep leading zeros.
- Verify the result. Check that the header row is still on top and that entire rows moved together. If only one column changed order while the others stayed put, you likely had a partial selection - press Ctrl+Z (Windows) or Cmd+Z (Mac) immediately and repeat from step 3.
Common Mistakes
Sorting a selected column instead of the whole table. If you highlight one column and hit the A-Z button, Excel may ask whether to expand the selection. Answering Continue with the current selection shuffles that column alone and destroys the relationship between rows. Always choose Expand the selection.
Wrong header setting. If your column titles end up sorted into the middle of the data, undo, then tick My data has headers. The reverse happens too: a first row of genuine data gets pinned to the top as if it were a label.
Blank rows splitting the table. Excel stops at the first completely blank row when it detects a range. If sorting only changes part of your data, delete or fill the blank rows first - the whole block then sorts as one.
Mixed data types in a column. Numbers stored as text sort one way, real numbers another. Cells with a green triangle in the corner are usually numbers held as text; use Data > Text to Columns or the error indicator to convert them.
Formulas pointing at fixed cells. If summary cells use absolute references into the sorted range, they may now point at the wrong row. Sort first, then rebuild formulas, or convert your range to an Excel Table (Insert > Table), which keeps structured references intact.
Tips
Convert your range to a Table before sorting. Tables expand automatically as you add rows, remember the header setting, and let you sort with the dropdown arrows on each column heading - far fewer surprises than raw ranges.
Use Freeze Panes on the header row so you can confirm labels stay in place while you check the sorted result.
For a one-off reorder that you do not want to keep, copy the range to a new sheet first and sort the copy. For regular reports, record a macro or use Power Query, which re-applies the sort every time data refreshes.
On the Excel mobile app the sort options are limited: tap a column header and use the sort arrows in the menu, but multi-level sorting and custom lists are desktop features. Use the desktop app for anything complex.
Troubleshooting
Sort buttons are greyed out. Almost always sheet or workbook protection, or the file is in a shared-workbook mode that restricts sorting. Unprotect, or ask the owner to remove protection.
“This operation requires the merged cells to be identically sized.” Merged cells exist anywhere in the range, even outside the column you are sorting. Select the whole block and unmerge everything, then sort.
Nothing happens when I click OK. Check that you picked a sort column and order, and that the range actually contains more than one row. Also confirm no filter is hiding rows - hidden rows may not move as expected.
Data comes back in a strange order. Custom lists or a leftover secondary sort level may be active. Open Data > Sort and use Delete Level to clear levels you did not intend to keep.
Formatting looks scrambled after sorting. Conditional formatting and cell colours can travel with rows in unexpected ways. Clear the sort, reapply formats after sorting, or use Table styles instead of manual fills.
Still stuck? Copy the data (values only) into a brand-new sheet with Paste Special > Values, remove blank rows and merged cells, and sort there. This strips the odd structures that block sorting.
Frequently Asked Questions
Why does Excel say my data has different sized cells?
That message means merged cells are present in the range. Unmerge all of them before sorting.
Can I sort a protected sheet?
Not without unprotecting it first. Sorting is one of the actions protection blocks outright.
Why did only one column sort?
You chose to continue with the current selection rather than expand it. Undo, then sort from a single cell inside the table so entire rows move together.
Does sorting break formulas?
Relative references move with their rows and are fine. Absolute references pointing at fixed cells are not updated, so summary formulas can end up reading the wrong row.
Can I sort by more than one column?
Yes - use Add Level in the Sort dialog, in the desktop version of Excel. The mobile app handles only basic single-column sorting.
How do I sort without losing the original order?
Add a helper column numbered 1, 2, 3 before sorting. You can re-sort by that column at any time to restore the original sequence.