Sub topic 3
Absolute references: locking a cell with $
This chapter assumes you can enter and edit a basic formula, select cells and ranges, and copy cells with the fill handle. It also assumes you have seen relative references, where a copied formula shifts its references by the same distance it moved.
The problem relative references cannot solve
Suppose column B holds prices and cell E1 holds a tax rate of 0.08. You write this in D2 and fill it down:
D2: =B2*E1In D3, Excel shifts both references down one row. The formula becomes =B3*E2. E2 is empty, so every row below the first gives 0. The price reference should move, but the tax rate reference should stay put.
Locking a reference with $
An absolute reference keeps pointing at the same cell no matter where the formula is copied. You make a reference absolute by putting a dollar sign before the column letter and before the row number. Write E1 as $E$1.
D2: =B2*$E$1When you fill this formula down, B2 is relative and shifts. $E$1 is absolute and does not. The result:
| Cell | Formula after filling down |
|---|---|
| D2 | `=B2*$E$1` |
| D3 | `=B3*$E$1` |
| D4 | `=B4*$E$1` |
Every row multiplies its own price by the same tax rate.
How to read the dollar signs
Each dollar sign locks the part of the address that follows it.
- The
$before the letter locks the column. - The
$before the number locks the row. $E$1has both, so the whole address is locked.
Locking both parts is what makes a reference absolute. Locking only one part gives a mixed reference, which the next chapter covers.
Absolute references with ranges
A range has two corner addresses, and each one can be locked separately. A common use is dividing each value by a total:
C2: =B2/SUM($B$2:$B$10)Here the whole range inside SUM is absolute. When you fill down to C3, the formula becomes =B3/SUM($B$2:$B$10). Each row's value is divided by the same total.
Compare this with leaving the range relative:
C2: =B2/SUM(B2:B10)
C3: =B3/SUM(B3:B11)In C3 the range has slid down, so it no longer covers the first row, and it now includes B11, which is outside your data. The percentages are wrong, and Excel shows no error.
Choosing a reference type
Ask one question about each reference in your formula: when this formula is copied, should this reference follow the formula or stay where it is?
- If it should follow, leave it relative. Examples are the price in the same row.
- If it should stay, make it absolute. Examples are a tax rate, an exchange rate, a total, or a lookup table.
Putting fixed inputs in their own cells, rather than typing the number into each formula, also lets you change the value once and update every result.
D2: =B2*0.08This works, but the rate is buried in the formula. Changing it means editing every formula that uses it.
Typing the dollar signs
You can type the $ characters by hand while editing a formula. A faster way is to click inside the reference in the formula bar, or place the cursor on it while editing, and press F4 on Windows. Each press cycles through the reference types. The next chapters cover that shortcut in detail.
Checking your work
After filling a formula, click a cell in the middle of the filled range and look at the formula bar. Confirm that the relative parts moved and the absolute parts did not. Pressing Ctrl+` (the grave accent key) on Windows switches the sheet to show formulas instead of results, which lets you compare many cells at once.
Exercises
Exercise
Column B (B2:B20) holds order amounts. Cell F1 holds a discount rate of 0.1. You write =B2*F1 in C2 and fill down to C20. C2 is correct but C3 shows 0. Why does this happen, and what formula should you write in C2 instead?
Show answer
Filling down shifts both references by one row each time. In C3 the formula becomes =B3*F2, and F2 is empty, so the result is 0. The discount cell must stay fixed, so write =B2*$F$1 in C2 and fill down.
Exercise
You write =B2/SUM(B2:B10) in C2 and fill down to C10. What does the formula in C4 look like, and why are the results wrong? How do you fix it?
Show answer
In C4 the formula is =B4/SUM(B4:B12). The range slides down with the formula, so it stops covering the whole data set and includes cells outside it. The fix is to lock the range: =B2/SUM($B$2:$B$10).