Sub topic 10
Recovering with Undo and Redo
This chapter covers how Undo and Redo work in Excel, what they can and cannot reverse, and how to recover when they are not enough. It assumes you can enter and edit cell contents, commit with Enter, and cancel with Esc, as covered in earlier chapters.
What Undo and Redo do
Undo reverses your most recent action. Redo re-applies an action you just undid. Excel keeps an ordered list of recent actions, and Undo walks backward through that list one step at a time.
| Command | Keyboard | Ribbon location |
|---|---|---|
| Undo | Ctrl+Z | Quick Access Toolbar, curved arrow pointing left |
| Redo | Ctrl+Y or F4 | Quick Access Toolbar, curved arrow pointing right |
Redo is only available right after you have undone something. As soon as you perform a new action, the Redo list is discarded.
On a Mac, Undo is Command+Z and Redo is Command+Y or Command+Shift+Z.
Undo versus Esc
Esc and Undo solve different problems.
- Esc cancels an entry that you have not yet committed. While you are still typing or editing in a cell, Esc discards the typing and restores the previous contents.
- Undo reverses an action that has already been committed with Enter, Tab, or a click on another cell.
If you type 500 over an existing value and press Enter, Esc can no longer help. Use Ctrl+Z instead.
The Undo list
Each committed action becomes one entry in the Undo list. Typing a value and pressing Enter is one entry. Applying bold is another. Pasting is another. Sorting a range is one entry, even though it moves many cells.
The small arrow beside the Undo button on the Quick Access Toolbar opens the list. You can select several entries and undo them all at once. Excel undoes everything from the top of the list down to the entry you pick, and you cannot skip an entry in the middle.
By default, Excel remembers up to 100 actions. The limit is a per-session limit, and it applies to the workbook window you are working in.
Walking through a sequence
Suppose you do the following in a blank sheet:
- Type
10in A1 and press Enter. - Type
20in A2 and press Enter. - Type
30in A3 and press Enter.
Now press Ctrl+Z twice. A3 and A2 become empty, and A1 still holds 10. Press Ctrl+Y once. A2 returns with 20.
Now type 99 in A3 and press Enter. The Redo list is cleared, because you took a new action. The earlier 30 in A3 cannot be restored with Redo. You can only get it back by typing it again.
What Undo reverses well
Undo covers most things you do while entering and editing data:
- Typing or editing a value, text, or formula
- Clearing contents, formats, or both
- Fill handle drags, Flash Fill, and Ctrl+Enter entries
- Find and Replace changes
- Formatting changes, such as number format or wrap text
- Inserting or deleting rows, columns, and cells
- Sorting and filtering
- Cut, copy, and paste operations
A Find and Replace that touches hundreds of cells counts as one action. A single Ctrl+Z reverses the entire replacement, which makes it relatively safe to experiment.
What Undo cannot reverse
Some actions are not recorded, or they empty the list entirely. Knowing these in advance prevents the worst surprises.
- Saving the workbook. Saving itself is not an action you can undo, and in many Excel versions saving clears the Undo list. After you save, you may find Ctrl+Z is unavailable or has little to undo. Whether the list survives a save depends on the version, so do not rely on it.
- Closing the workbook. The Undo list belongs to the open session. Reopen the file and the history is gone.
- Running a macro. A macro that changes cells usually clears the Undo list. If you run a macro that edits your data, assume you cannot undo it.
- Deleting a worksheet. Excel asks for confirmation first, and the deletion cannot be undone afterward.
- Actions outside the workbook. Deleting the file from disk, or changes made in another program, are not tracked.
- Some data operations. Refreshing external data connections and certain add-in actions can clear the list.
Undo and the stored value
Undo restores what was stored in the cell, not only what was displayed. If you replaced a formula such as =A2*B2 with the typed number 150, Ctrl+Z brings back the formula, not a number that looks like 150. This matches the distinction in the earlier chapter on stored versus displayed values. Likewise, if you typed 1/2 and Excel converted it to a date, Undo returns the cell to whatever it held before, and it does not preserve the date conversion as a separate step you could keep.
Common errors
Pressing Undo too many times. Each press removes one more action. If you overshoot, press Ctrl+Y to move forward again. Do this before you perform any new action, because a new action discards the Redo list.
Expecting Redo after a new action. A common pattern is to undo, notice a small issue, fix it by typing, and then try Redo. Redo no longer works, because the typing replaced the Redo list.
Confusing Redo with Repeat. F4 does two jobs. If you have just used Undo, F4 acts as Redo. Otherwise F4 repeats your last action, for example applying the same fill color to another cell. When a formula cell is in edit mode, F4 instead cycles between absolute and relative references. Check which situation you are in before pressing it.
Undoing in the wrong window. Each workbook window has its own Undo list. If you switch to another workbook and press Ctrl+Z, you undo that workbook's last action, and your first workbook is untouched.
Assuming a saved file can be rolled back. After you save and close, the history is gone. Recovery then depends on other tools, described next.
Recovering when Undo is not enough
When Undo is unavailable, these options may still help.
- Revert with Version History. If the workbook is stored on OneDrive or SharePoint, open File, then Info, then Version History, and open an earlier saved version.
- Use AutoRecover files. Excel periodically saves a recovery copy of open workbooks. After a crash, Excel offers to open recovered versions. Check File, then Info, then Manage Workbook for unsaved versions.
- Close without saving. If you made a mistake and have not saved, closing the workbook and choosing Don't Save returns you to the last saved state. Use this deliberately, and only when you are sure you want to discard all unsaved changes.
- Open a backup copy. If you made a copy with Save As before the risky step, open it.
- Check the Recycle Bin. A deleted workbook file may still be in the system Recycle Bin or in the OneDrive recycle bin.
Version History and AutoRecover depend on settings that may be turned off, so confirm they are active before you depend on them.
A safe working habit
A short routine reduces the chance that you need recovery at all.
- Save a copy before bulk changes such as Replace All, large deletions, or sorting a big range.
- Perform the change, then inspect a few cells before doing anything else.
- If the result is wrong, press Ctrl+Z immediately, before saving.
- Save only after you have confirmed the result.
Following this order means the Undo list is still intact at the moment you most need it.
Summary of key points
- Ctrl+Z undoes committed actions, one at a time, or several at once through the Undo list.
- Esc cancels an uncommitted entry, and Undo reverses a committed one.
- Ctrl+Y redoes what you undid, but a new action clears the Redo list.
- Saving, closing, macros, and deleting a worksheet can end your ability to undo.
- Version History, AutoRecover, and backup copies are the fallback.
Exercise
In a blank sheet you type 5 in A1, 6 in A2, and 7 in A3, pressing Enter after each. You press Ctrl+Z twice, then type 8 in A2 and press Enter. What does the sheet contain, and can you restore the 6 with Redo?
Show answer
A1 contains 5, A2 contains 8, and A3 is empty. The two undos removed 7 and 6. Typing 8 was a new action, which cleared the Redo list, so Redo cannot bring back 6 or 7. You would have to type them again.
Exercise
You are editing A1 and have typed a new value, but you have not pressed Enter. You want the original value back. Should you use Esc or Ctrl+Z, and why?
Show answer
Use Esc. The entry is not committed yet, so Esc discards the typing and restores the previous contents. Ctrl+Z is for actions that were already committed.
Exercise
You run Replace All on a large range, save the workbook, and then notice the replacement was wrong. Ctrl+Z does nothing. Name two ways you could still recover the original data.
Show answer
Open an earlier version through File, Info, Version History if the file is on OneDrive or SharePoint, or open a backup copy made with Save As before the change. AutoRecover or the Recycle Bin may also help in some cases.