Sub topic 7
Editing Cells, Filling Formulas, and Anchoring References
This chapter assumes you can enter formulas, copy cells, and tell a relative reference (A1) from an absolute one ($A$1). It covers the keyboard actions for editing a cell, filling formulas across a model, and anchoring references. These are the actions you repeat most often in a financial model, so small errors here spread widely.
Why editing discipline matters in a model
A financial model works because one formula pattern is repeated across a row. If the pattern is consistent, you can audit one cell and trust the rest. If one cell differs, the model can look right while producing a wrong total.
Most inconsistencies come from three sources: typing over a formula, copying a formula with the wrong anchoring, and filling a range that includes a cell you did not mean to overwrite. The shortcuts below reduce all three.
Editing a cell from the keyboard
Pressing F2 edits the active cell and puts the cursor at the end of its contents. Double-clicking does the same, but it also depends on where you click. F2 does not.
F2 has two modes. When you press it on a formula, Excel highlights each referenced cell in a color that matches the reference in the formula. While in this mode, the arrow keys move the cursor within the text. Press F2 again and the arrow keys change to Point mode. In Point mode, an arrow key inserts or changes a cell reference instead of moving the cursor.
Point mode is a common source of errors. If you press an arrow key while editing and a reference appears that you did not intend, you are in Point mode. Press F2 to switch back to Edit mode, then fix the formula.
| Key | Action while editing |
|---|---|
| `F2` | Enter Edit mode, or toggle between Edit and Point mode |
| `Enter` | Accept the edit and move down |
| `Tab` | Accept the edit and move right |
| `Esc` | Cancel the edit and restore the original contents |
| `Ctrl+Enter` | Accept the edit and stay on the same cell |
Esc is the safest way out of an edit you are unsure about. It restores the cell exactly as it was.
Anchoring references with F4
A reference has two parts, the column letter and the row number. A $ before a part locks it, so it does not change when the formula is copied or filled.
While the cursor is on or next to a reference in Edit mode, F4 cycles through the four states:
$A$1: column and row both locked.A$1: row locked, column free.$A1: column locked, row free.A1: both free.
The cycle starts from whatever state the reference is in. If it starts as A1, the first press gives $A$1.
Mixed references are the most useful for models. Suppose row 5 holds period headers and column B holds a driver for each line item. This formula can be filled right and down:
=C$5*$B8C$5 locks the row, so every cell reads the header in row 5, while the column moves as you fill right. $B8 locks the column, so every cell reads the driver in column B, while the row moves as you fill down. One formula then serves the whole block.
The diagram shows which parts of the reference move.
In D8, the first reference moved from C to D, because its column is free. The second stayed on $B8. In C9, the first stayed on row 5, and the second moved to row 9.
Filling formulas
Filling copies a formula and adjusts its relative parts. Two shortcuts cover most cases:
Ctrl+D Fill down from the top cell of the selection
Ctrl+R Fill right from the leftmost cell of the selectionTo fill, select the source cell and the cells you want to fill, then press the shortcut. The source must be the first cell in the direction of the fill. For Ctrl+D, it is the top row of the selection. For Ctrl+R, it is the leftmost column.
Ctrl+Enter is another way to fill. Select a range, type a formula in the active cell, and press Ctrl+Enter. Excel enters the formula in every selected cell, adjusting relative references as if you had copied it.
A fast sequence for extending a row of formulas is:
- Click the first formula cell.
- Press
Ctrl+Shift+Right Arrowto select to the end of the neighboring data. - Press
Ctrl+R.
For the selection in step 2 to reach the right place, the neighboring row (often the period headers) must cover the same columns. See the navigation chapter for how the jump keys treat blank cells.
Copy and paste with the clipboard
Fill overwrites cells with a formula. Sometimes you want only part of what a cell holds. Paste Special lets you choose, and Ctrl+Alt+V opens its dialog after you copy.
| Option | Use |
|---|---|
| Formulas | Paste formulas and keep the destination formatting |
| Values | Replace formulas with their results |
| Formats | Paste formatting only |
| Column widths | Match widths between blocks |
Pasting values over a formula removes the formula permanently. Do this only when you intend to freeze a result, such as a pasted historical figure, and mark such cells as inputs using the color convention from the earlier chapter.
Editing many cells safely
Three habits prevent most errors.
- Edit the first cell, then fill. Fix the formula in the leftmost cell of a row and fill right. Editing cells one by one invites inconsistency.
- Check the whole row afterward. Select a cell in the row and press
Ctrl+[to see its precedents, or toggleCtrl+` to display all formulas. A formula whose pattern differs from its neighbors stands out. - Avoid typing over formulas in a calculation block. If a number must change, change the input it comes from. A hardcoded value inside a formula row is easy to miss, and it will not update when assumptions change.
A related habit is to avoid constants inside formulas. Compare these two versions of a tax calculation:
=C20*0.25
=C20*$C$4The first hides the 25% rate. The second reads it from an input cell, C4, which is locked with $ so it stays in place when filled. Changing the rate once then updates every period.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| Filled row shows the same value in every column | Reference was fully locked (`$A$1`) when it should vary | Press `F4` until the needed part is free |
| Filled row shows zeros or shifting values | Reference was fully relative (`A1`) when the input should stay fixed | Anchor the input with `F4` |
| Arrow key inserts an unexpected reference | Excel is in Point mode | Press `F2` to return to Edit mode |
| `Ctrl+D` does nothing useful | The source cell is not at the top of the selection | Reselect starting from the source cell |
| Formula disappears after paste | Pasted values over it | Undo with `Ctrl+Z` and paste formulas instead |
Putting it together
A typical build step runs like this. You enter the formula in the first period column, using the mouse or arrow keys to point at cells and F4 to anchor the drivers. You press Enter, reselect the row with Ctrl+Shift+Right Arrow, and fill with Ctrl+R. Then you spot-check the last column with F2, which highlights the cells it reads, and press Esc to leave without changing it.
Exercise
Cell C8 contains =C$5*$B8. You copy it to E10. What formula does E10 contain, and why?
Show answer
E10 contains =E$5*$B10. The copy moved two columns right and two rows down. The column of the first reference is free, so C becomes E. Its row is locked, so it stays at 5. The column of the second reference is locked, so it stays at B. Its row is free, so 8 becomes 10.
Exercise
You are editing a formula and press the Left Arrow key. Instead of moving the cursor, a cell reference appears in the formula. What happened, and how do you recover?
Show answer
Excel is in Point mode, where arrow keys select cells to reference. Press Esc to cancel the whole edit, or remove the unwanted reference and press F2 to return to Edit mode, where arrow keys move the cursor within the text.
Exercise
A tax line is written as =C20*0.25 and filled across 10 periods. Why is this a modeling problem, and how would you rewrite it using an input in C4?
Show answer
The 25% rate is hardcoded in every cell, so changing it means editing all ten formulas, and it is easy to miss one. Put the rate in C4, then write =C20*$C$4 and fill right. Press F4 to lock the reference so it does not shift as the formula is filled.