Excel cannot undo a sort once you have saved and closed the workbook, but you can usually reverse it in seconds with Ctrl+Z if the sort was the last thing you did. If you have saved since sorting, or the undo history is gone, you reverse the order by re-sorting on the same column in the opposite direction (Smallest to Largest) or by restoring the original row order from a helper column you added before sorting. The catch is that a sort rearranges entire rows, so any formula references, formatting tied to row position, or manual row order you relied on will not come back on its own.
What You'll Need
- Excel for Windows, Mac, or Excel for the web (steps are nearly identical; menu names can differ slightly by version, device, and region).
- The workbook open, ideally with the sort as your most recent action.
- If you already saved: a helper column with sequential numbers, or a backup copy of the file, because undo history does not survive a save-and-close.
Step-by-Step
- Try the immediate undo first. Press Ctrl+Z (Cmd+Z on Mac) once. If the sort was your last action, all rows snap back to their previous order instantly. Press it again only if you also want to undo the step before the sort.
- Check the Quick Access Toolbar. If the keyboard shortcut does nothing, click the curved Undo arrow at the top left. Hovering over it shows which action will be reversed, so you can confirm it says Sort before clicking.
- Confirm nothing else happened after the sort. Typing in a cell, applying a format, or inserting a row after sorting means Ctrl+Z will undo that later action first. Press Ctrl+Z repeatedly until the sort itself is reversed, watching the sheet after each press.
- If undo is unavailable, re-sort in the opposite direction. Click any cell inside the column you originally sorted on, then go to the Data tab and choose Sort Smallest to Largest (the A-to-Z button) instead of Sort Largest to Smallest. This restores ascending order, which is the reverse of what you applied.
- Sort by more than one column if the original sort was multi-level. Open Data > Sort, set the first Level back to the original column in ascending order, add the second Level the same way, and click OK. Reversing only the top level leaves ties in the wrong order.
- Restore a true original order from a helper column. If you added a numbered column (1, 2, 3...) before sorting, select any cell in that column, go to Data > Sort Smallest to Largest, and the rows return to their pre-sort sequence. Delete the helper column afterward if you no longer need it.
- Use a backup if no helper column exists. Open the previous version from File > Info > Version History (available for files saved to OneDrive or SharePoint) or open your saved copy, then copy the original rows back into the working sheet.
- Re-check formulas and references. After any reversal, scan for #REF! errors and confirm that formulas still point at the rows you expect. Sorts move cells, so relative references can shift meaning even when the data looks right.
Common Mistakes
- Sorting a single column instead of the whole table. If Excel asks whether to expand the selection and you choose Continue with the current selection, only that column reorders and rows no longer match. Undo immediately, then sort again with the whole range selected.
- Assuming Ctrl+Z works after saving. Saving does not always clear undo, but closing and reopening the workbook does. Once the file is reopened, undo cannot reverse the sort.
- Re-sorting the wrong column. Reversing on a different column than the original produces a plausible but wrong order. Check the header name before clicking the sort button.
- Forgetting that ties break unpredictably. Two rows with the same value can swap places between sorts. Only a helper column guarantees the exact original sequence.
- Ignoring merged cells. Merged cells across rows make sorting unreliable and can trigger errors. Unmerge, sort, then remerge if needed.
Tips
- Add a numbered helper column before any sort you might want to reverse. It takes ten seconds and makes a perfect restore possible.
- Convert your range to a table with Ctrl+T. Tables keep headers attached and make multi-level sorts cleaner.
- Save a copy of the file before large reorders (File > Save As) so you always have a fallback.
- Use Data > Sort with the My data has headers checkbox ticked so the header row stays at the top and never gets sorted into the data.
- If you sort often, record the sort order in a note or a spare cell so you can reproduce it later.
Troubleshooting
- Ctrl+Z does nothing or greys out. The undo stack is empty because the file was closed, the action was too old, or the workbook is shared. Move to the re-sort or helper-column method.
- The reversed sort looks wrong. You probably sorted on a different column or missed a second sort level. Open Data > Sort and rebuild every level in ascending order.
- Rows are mismatched after sorting. A single column was sorted on its own. Undo, select the entire table including headers, and sort again.
- Formulas show #REF! after reversing. References broke when rows moved. Use Ctrl+Z again to step back, or repair the formulas by re-pointing them at the correct cells.
- Version History is missing. It requires the file to be stored on OneDrive or SharePoint with autosave history. Local-only files have no version history, so rely on your own backup copies.
- Sort buttons are greyed out. The sheet may be protected (Review > Unprotect Sheet) or the workbook is in a mode that blocks edits. Unprotect with the password, then retry.
Frequently Asked Questions
Can I undo a sort after saving and closing the file?
Not with Ctrl+Z. Undo history is lost when the workbook closes. Re-sort the column in the opposite direction, restore from a numbered helper column, or open a previous version from Version History if the file is stored online.
Does Ctrl+Z reverse a multi-level sort completely?
Yes, if the sort was the last action and undo history is intact. Otherwise you must rebuild each sort level manually in Data > Sort.
Why did only one column reorder when I sorted?
Excel sorted the selected range only. When prompted, choose Expand the selection so entire rows move together, or select the whole table before sorting.
Can I recover the original row order without a helper column?
Only from a backup or a previous version. Without either, the original sequence is not stored anywhere in the file and cannot be reconstructed exactly, especially where duplicate values exist.
Does sorting break formulas?
Sorting moves cells, so relative references adjust and can point at different data. Absolute references and structured table references are safer. Check for errors after any sort or reversal.
Is there a way to lock row order so it cannot be sorted?
You can protect the sheet (Review > Protect Sheet) to prevent sorting, but that also blocks other edits unless you allow them. A helper column is usually the simpler safeguard.