Excel’s undo functionality lets you reverse the last action almost instantly—but knowing how to use it properly saves countless hours. After entering a formula, deleting data, or formatting cells, pressing Ctrl+Z (Windows) or Cmd+Z (Mac) instantly restores your previous state. If you close the file without using the undo shortcut, you’ll need alternative methods. Here’s how to recover your last command in any Excel version.
What You'll Need
- Active Excel workbook (or an open Excel session if closed)
- Keyboard shortcuts (Ctrl+Z / Cmd+Z) or the Undo button in the ribbon
- Right-click options (for recent actions list) or file recovery tools (if the file was lost)
- File history or cloud backups (for permanent recovery)
Step-by-Step
-
Use the Undo shortcut immediately:
Press Ctrl+Z (Windows) or Cmd+Z (Mac) to undo the last action. This works for:
- Typing or deleting text
- Entering formulas (e.g., =SUM())
- Formatting cells (font, bold, alignment)
- Adding/removing shapes or charts
- Find recent actions in the ribbon: - Click the Review tab at the top. - Look for the Undo button (a curved arrow icon) in the Edit group. Click it to reverse the last change. - If you used multiple undo actions in sequence, Excel displays a dropdown of recent actions (e.g., "Undo Delete," "Undo Paste").
- Use the Undo cloud (for multi-step edits): - Right-click the active cell or shape and select Undo from the dropdown menu. This appears only for the most recent action. - For worksheets, right-click the sheet tab and choose Undo to revert the entire sheet’s last edit.
-
Recover from a closed file (if you closed without saving):
- Check Excel’s temporary recovery options: - Open Excel and look for the File tab > Info > Recover Unsaved Workbooks. If a file was open recently, Excel may prompt you to restore it.
-
Look in the recovery folder:
Windows: Navigate to:
C:\Users\[YourUsername]\AppData\Roaming\Microsoft\Excel\RecentMac: Check the~/Library/Containers/com.microsoft.Excel/Data/Library/Application Support/Microsoft/Office/Recentfolder. Warning: Do not open or edit these files manually—use Excel’s recovery tools instead. - Use cloud backups (OneDrive/SharePoint): - If you saved to OneDrive or SharePoint, sign in to your browser, open the file under Files, and select Open with Excel. - For SharePoint, go to Library > Files > Open > Excel.
- File History or cloud versions: - Enable Excel’s file backup: File > Options > Save > Save a copy of this file (auto-cloud backup). - Check your cloud provider’s version history (e.g., OneDrive’s Versions tab).
-
Last resort: Rebuild from scratch:
- If the file is unrecoverable, create a new workbook and manually recreate:
- Data tables (copy-paste from backups)
- Formulas (verbal check or use a formula assistant)
- Formatting (use the Format Painter tool if needed)
Common Mistakes
- Closing Excel without undoing: If you press Ctrl+Z after closing, Excel won’t save the undo stack—only manual recovery methods (Step 4) apply.
- Over-undoing: Repeatedly pressing undo can delete layers of work. For example, undoing three times removes the last three actions, not just the last one. File corruption: Accidental file corruption (e.g., power loss) may prevent recovery. Always save frequently using Ctrl+S or cloud sync.
Tips
- Enable automatic saving: Go to File > Options > Save, check Save AutoRecover file every (e.g., every 5 minutes), and enable Save a copy of this file in OneDrive.
- Use keyboard shortcuts: Ctrl+Y is the shortcut for Redo, which reverses an undo—great for undoing undos.
- Enable macros for data recovery: For advanced users, enable macros (if trusted) via File > Options > Trust Center > Macro Settings, then use a VBA script to recover unsaved data.
- Check for hidden macros: If the file was shared, macros may be enabled by default. Disable them via File > Options > Trust Center > Macro Settings before opening.
Troubleshooting
If Excel refuses to undo or recover your file:
- Restart Excel: Close all Excel instances, restart your computer, and reopen the file. Sometimes a glitch prevents undo functionality.
-
Check for file locks:
- On Windows, run
Task Manager(Ctrl+Shift+Esc) and end the Microsoft Excel process if it’s unresponsive. - On Mac, force quit viaCmd+Option+Escand restart. - Repair Excel: - Windows: Open Excel > File > Options > Manage Excel > Repair (not all versions support this). - Mac: Use the built-in Utilities app to repair permissions, but not Excel itself.
- Reinstall Excel (last resort): If the file is corrupted past recovery, reinstall Excel from the Microsoft Store or Office download page. Warning: This deletes personal settings and bookmarks.
- Contact support: If the issue persists, open File > Help and search for Excel error or “My file won’t open” to find Microsoft’s troubleshooting steps.
Frequently Asked Questions
Can I undo a closed file if I didn’t save it?
Yes, but only if Excel’s AutoRecover feature was enabled. Check your Recent Files list (File > Open) or the recovery folder (see Step 4).
Why won’t Ctrl+Z undo my last action?
Possible reasons include:
- The action was a system change (e.g., sheet splitting) or a macro.
- You accidentally pressed Ctrl+Shift+Z, which overrides undo.
- Excel was opened as an admin user—try closing as a regular account.
How do I undo a formula but keep the cell value?
Excel treats formulas differently from cell values. To undo a formula but preserve the result:
- Right-click the cell > Format Cells > Protection (unprotect the sheet).
- Enter a static value (e.g.,
0) in the cell. - Undo the formula (Ctrl+Z).
- Re-enter the correct formula later.
What if my entire worksheet is corrupted?
Try these steps before reinstalling:
- Save a backup copy via File > Save As.
- Open the file in a text editor (e.g., Notepad) to check for XML corruption (skip this if you’re not comfortable).
- Use Excel’s File > Open > Browse and select File Format: All Files (.xlsx, .xlsm, etc.) to force a repair.
Can I undo a paste operation after it’s been merged?
Yes, but only if you didn’t merge cells permanently. To undo:
- Press Ctrl+Z immediately after pasting.
- If merged cells remain, select the merged range, right-click > Merge & Center > Unmerge Cells.
Why does Excel’s undo stack keep disappearing?
This happens when:
- You closed the file without saving the undo stack.
- You started a new workbook while another was open.
- Excel crashed or crashed while editing.
To fix: Enable AutoRecover (see Tips) and restart Excel.