Sub topic 7
Editing a Cell Without Retyping It
This chapter assumes you can type into a cell and commit with Enter, Tab, or Esc. It also assumes you know the difference between the active cell and the formula bar. Here you will learn the three ways to change an existing entry in place, what each one does to the keyboard, and the mistakes that cost people data.
Why editing differs from typing
If you select a cell and start typing, Excel replaces the whole contents. That is the right behavior for a new entry. It is the wrong behavior when a long formula has one wrong cell reference or a text label has a typo.
Excel has a separate state for changing what is already there. It is called Edit mode. In Edit mode a text cursor appears inside the entry, and you can move through the characters and change only the ones you need.
Three ways to enter Edit mode
| Method | How | Where the cursor lands | Notes |
|---|---|---|---|
| F2 | Select the cell, press F2 | At the end of the contents, inside the cell | Fastest from the keyboard |
| Double-click | Double-click the cell | Where you clicked | Does not work if the setting "Allow editing directly in cells" is off |
| Formula bar | Select the cell, click in the formula bar | Where you clicked | Always available, and useful for long entries |
All three change the same stored contents. They differ in where you see the text cursor and in a few key behaviors.
F2 and in-cell editing
F2 puts the cursor at the end of the entry. From there:
- Left and Right arrow keys move one character.
- Ctrl+Left and Ctrl+Right move one word.
- Home and End jump to the start and end of the line.
- Shift+Arrow selects characters so you can overwrite or delete them.
Double-clicking is the same kind of editing, but you choose the position with the mouse. Be careful with the double-click on a cell border. A double-click on the edge of the cell does not start editing. It jumps the selection to the edge of the data region in that direction.
The formula bar
The formula bar shows the real contents of the active cell, even when the cell shows something else. For a long formula or a long block of text, it is easier to work there because it can be expanded. Use the arrow at its right end, or press Ctrl+Shift+U, to show more than one line.
To start editing in the formula bar with the keyboard, select the cell and press F2, then F2 again. The second press moves you from in-cell editing to the formula bar's cursor position in some configurations. If that does not work on your version, click in the formula bar instead.
The two sub-states: Edit and Enter
While you are typing, the status bar at the bottom left shows one of two words. It changes how the arrow keys behave.
- Enter means you are typing a new entry, or you just started typing over a selected cell. An arrow key commits the entry and moves the selection to the next cell.
- Edit means the text cursor is inside existing contents. An arrow key moves the cursor within the text and does not leave the cell.
Pressing F2 while in Edit state switches to Enter state, and the other way around. This is the answer to a common complaint: "I am editing a formula and the arrow keys keep moving to another cell." The status bar says Enter. Press F2 and it says Edit, and the arrow keys move the cursor again.
The reverse matters for formulas. In Enter state, pressing an arrow key while building a formula inserts the reference of the cell you move to. That is called pointing, and it is useful when you want it.
Status bar: Enter -> arrow keys commit the entry or point to cells in a formula
Status bar: Edit -> arrow keys move the text cursor
Press F2 to toggle between themCommitting or canceling the edit
An edit is not saved until you commit it.
- Enter commits and moves the selection down (or in the direction set in Excel options).
- Tab commits and moves right.
- Ctrl+Enter commits and keeps the same cell selected.
- Esc cancels and restores the previous contents.
- The check mark beside the formula bar commits, and the X cancels.
Esc is your safety net while you are in Edit mode. If you realize halfway through that you changed the wrong cell, press Esc and nothing is changed. Once you commit, you must use Undo instead, covered in a later chapter.
Editing a formula safely
Formulas are where in-place editing pays off most. Suppose C2 contains this formula:
=A2*B2You want it to use D2 instead of B2. Select C2, press F2, and the cell shows the formula with colored outlines around A2 and B2 on the sheet. These outlines are range finders. You can drag a colored outline to a different cell to change the reference, or you can type the change with the keyboard.
Steps with the keyboard:
- Select C2 and press F2. The status bar says Edit.
- Press Left once to move before the last character, then press Backspace to delete
2, and then Backspace to deleteB. - Type
D2, then press Enter.
The formula now reads =A2*D2.
If you want to change a reference without typing it, you can select it in the formula text and then click the new cell. Excel replaces the selected reference with the one you clicked. This only works when the text cursor is at a place where a reference is expected, such as after an operator, or when the old reference is selected.
Changing reference types with F4
While the cursor is in or next to a reference in Edit mode, F4 cycles through the reference styles. For A2 it goes to $A$2, then A$2, then $A2, then back to A2. This is the fast way to anchor a reference before you copy a formula. On some laptops you need Fn+F4.
Editing text and numbers
For text, editing in place keeps the characters you do not touch. This matters for two reasons.
First, it saves effort on long labels. Second, it keeps the entry type. If a cell holds the text 00123, entered with an apostrophe, editing it in place leaves the text as it is. Retyping 00123 without an apostrophe would give you the number 123 and lose the leading zeros. Here the stored text is shown below.
'00123The apostrophe is part of how you entered it. It is not stored as a character in the text, and it does not appear in the cell. But you do see it in the formula bar when you select the cell. If you press F2 and then Enter without changing anything, the text stays text.
A second caveat applies to numbers. When you edit a number in place and commit it, Excel reinterprets what you typed using the normal rules. If you edit 1.50 to 1.5, the stored value is the same number, and the display depends on the cell's number format. The stored and displayed values are discussed in the previous chapter.
Common errors and how to avoid them
| Problem | Cause | Fix |
|---|---|---|
| Double-click does nothing | "Allow editing directly in cells" is off in File > Options > Advanced | Turn it on, or use F2 or the formula bar |
| Arrow keys leave the cell during an edit | Status bar says Enter | Press F2 to switch to Edit |
| The whole entry vanished after typing | You were not in Edit mode, so typing replaced the contents | Press Ctrl+Z, then use F2 first |
| A formula shows an error after editing | A reference was deleted or a bracket is unbalanced | Press Esc and try again, or fix the highlighted reference |
| Edit shortcut seems to do nothing | The workbook is protected, or the cell is locked | Unprotect the sheet, or edit a cell that is not locked |
| Cell is stuck in Edit mode and menus are gray | Excel is waiting for you to commit or cancel | Press Enter or Esc |
That last problem is worth remembering. Most commands on the ribbon are unavailable while a cell is in Edit mode. If the ribbon is gray, check the status bar. Commit or cancel the edit first.
Editing part of an entry
Edit mode lets you work on part of a cell without touching the rest.
- To change a word, double-click inside the cell on that word, which selects it, then type the replacement.
- To replace everything after a point, put the cursor there and press Ctrl+Shift+End in the formula bar, then type.
- To delete the rest of the line from the cursor, press Ctrl+Delete to delete a word, or select to the end and press Delete.
You can also format characters within a text cell while in Edit mode. For instance, you can select one word and make it bold. This works only for text. In a cell holding a number or a formula, formatting applies to the whole cell.
A workflow that avoids mistakes
- Select the cell and look in the formula bar. This shows the real contents.
- Press F2 and check that the status bar says Edit.
- Make the smallest change that fixes the problem.
- Press Enter to commit, or Esc if you are unsure.
- Look at the result. If it is wrong, press Ctrl+Z.
Exercise
Cell C2 holds the formula =A2*B2. You press F2, then press the Left arrow, but the selection moves to a different cell and the formula is not edited. What does the status bar say, and what do you press to fix it?
Show answer
The status bar says Enter. In that state, an arrow key commits the entry and moves, or points to a cell. Press F2 to switch to Edit state, and the arrow keys then move the text cursor within the formula.
Exercise
A cell holds the text 00123, entered with a leading apostrophe. You need to change it to 00124. Why is it safer to use F2 than to select the cell and type the new value, and what must you include if you do retype it?
Show answer
Selecting the cell and typing replaces the contents, and Excel then reads 00124 as a number and stores 124. With F2 you change only the last digit and the text type is kept. If you retype, you must start with an apostrophe: '00124.