Sub topic 5
Editing Cells and Undoing Changes
This chapter assumes you can select cells and ranges, type values and formulas into a cell, and know that Sheets decides whether an entry is text, a number, a date, or a formula. Here you will learn how to change what a cell already holds, how to recover from mistakes, and where undo stops working.
Two ways to change a cell
A cell can be in one of two states: selected or editing. When a cell is only selected, the next thing you type replaces its whole contents. When the cell is in edit mode, the cursor sits inside the existing content, and what you type is inserted at the cursor.
| Action | Result |
|---|---|
| Select the cell and start typing | Replaces the entire contents |
| Press F2 or Enter on a selected cell | Enters edit mode with the cursor at the end of the content |
| Double-click the cell | Enters edit mode with the cursor where you clicked |
| Click the formula bar while the cell is selected | Edits the same content in the bar |
| Select the cell and press Delete or Backspace | Clears the contents but keeps the formatting |
On a Mac, the equivalent of F2 may be Fn+F2, or you can press Enter. If your keyboard shortcuts differ, check the list under Help, then Keyboard shortcuts.
The formula bar is useful for long text and long formulas. In the bar, Alt+Enter (Option+Enter on Mac) inserts a line break inside the cell, while a plain Enter finishes the edit.
Committing or cancelling an edit
An edit stays provisional until you commit it. The keys behave differently:
- Enter commits the edit and moves the selection down.
- Tab commits the edit and moves the selection right.
- Shift+Enter and Shift+Tab commit and move up or left.
- Esc cancels the edit and restores the previous content.
Esc is the cheapest undo. If you notice a mistake before committing, press Esc and the cell is exactly as it was.
Clearing versus deleting
Pressing Delete clears the contents of the selected cells. The formatting stays. This surprises people who expect a "clean" cell: a cell that held a date and had a date format will still have that format, so the next number you type in it may appear as a date.
To clear the formatting as well, select the cells and choose Format, then Clear formatting (Ctrl+\\). This removes fonts, colors, and number formats but leaves the values. It does not remove data validation rules or conditional formatting set elsewhere.
Deleting is a different operation. Right-clicking and choosing Delete row or Delete column removes the cells themselves, and everything below or to the right shifts to fill the gap. Formulas that referred to the removed cells then show a #REF! error.
Undo and redo
Sheets keeps a history of your actions in the current session. Use these commands:
- Undo: Ctrl+Z (Cmd+Z on Mac), or the arrow button in the toolbar.
- Redo: Ctrl+Y or Ctrl+Shift+Z (Cmd+Shift+Z on Mac).
Undo reverses one action at a time, in reverse order. Typing in a cell and pressing Enter is one action. Pasting a large range is also one action, so a single undo reverses the whole paste. Sheets may group several rapid edits together.
If you undo too far, redo steps forward again. As soon as you make a new change after undoing, the steps you undid are discarded and redo is no longer possible for them.
While you are typing
Ctrl+Z works differently inside a cell in edit mode. It undoes the typing inside that cell, not earlier actions on the sheet. After you commit the edit, Ctrl+Z reverses the commit as a whole.
Version history: undo for the long run
Ctrl+Z only covers what Sheets remembers in your current session, and it can be lost when you reload the page. For older changes, use version history. Open it through File, then Version history, then See version history (Ctrl+Alt+Shift+H).
Version history shows saved versions of the whole file, with names, times, and the people who edited. You can click a version to view it. Selecting Restore this version replaces the current file contents with that version. For a single cell, there is a narrower option. Right-click the cell and choose Show edit history, which lists previous values with the editor and time.
You can restore a version without losing the present one: Sheets keeps the current state in the history, so you can go back if the restore was a mistake.
| Need | Best tool |
|---|---|
| Reverse the last edit or paste | Ctrl+Z |
| Check who changed one cell, and to what | Show edit history on the cell |
| Roll the whole file back to an earlier time | Version history |
| Keep a safe copy before a risky bulk change | File, then Make a copy |
Edge cases and common errors
- Undo does not reach across reloads. Reloading or reopening the file clears the undo stack. Use version history after that.
- Undo can affect other people's work. In a shared sheet, your undo reverses only your own recent actions, but it may overwrite a cell that someone else has since changed. Check the cell afterward.
- Typing over a formula. If you select a cell with a formula and type, the formula is replaced. Undo brings it back, but only if you act before other edits push it out of the stack, so use Esc or Ctrl+Z at once.
- Autocomplete in text entries. When you type text in a column, Sheets can suggest a match from earlier entries. Pressing Enter accepts the suggestion. To keep what you typed, press Delete to remove the grey suggestion before Enter.
- Leading apostrophe. An apostrophe at the start, such as
'0123, forces text and keeps the leading zero. The apostrophe does not show in the cell, but it appears in the formula bar while you edit. - Edits in a protected range. If the range is protected, Sheets blocks the edit or warns you, and undo cannot help because no change was made.
Editing several cells at once
You can change many cells in one step. Select a range, type a value, and press Ctrl+Enter. Every selected cell receives that entry. When the entry is a formula, relative references adjust for each cell, as if you had filled it in.
=B2*$E$1If you type this formula in C2 with C2:C10 selected and press Ctrl+Enter, each cell in the range gets its own version of the formula. C3 contains =B3*$E$1, and so on. The $E$1 stays fixed because it is an absolute reference. One undo reverses all nine cells.
A safe editing routine
- Make a copy of the file or note the current version before large changes.
- Confirm the selected range in the name box.
- Make the change, then look at the result before doing anything else.
- If it is wrong, press Ctrl+Z immediately. Every extra action makes recovery harder.
- If you have lost the undo stack, open version history or the cell's edit history.
Exercise
You clear the contents of D2:D20 with the Delete key, then type a number into D2 and it appears as a date. Why does this happen, and how do you fix it without retyping the data?
Show answer
Delete clears only the contents. The date number format from the old data is still on the cells, so the new number is displayed as a date. Select the cells and use Format, then Clear formatting (Ctrl+\), or set the number format to Automatic or Number. The stored number itself is unchanged and will display correctly once the format is fixed.
Exercise
You paste a large range, make two more edits, reload the page, and realize the paste was wrong. Does Ctrl+Z help? What do you use instead?
Show answer
No. Reloading clears the undo stack, so Ctrl+Z cannot reach the paste. Open File, then Version history, then See version history, find a version from before the paste, and restore it. For one cell you can use Show edit history instead.