Excel course · Lesson 4 of 34
Cell references: relative, absolute and mixed
Understand why formulas change when copied, lock cells with $A$1, use mixed references and F4, and refer to other sheets and workbooks.
Copying formulas is what makes Excel fast: write a formula once, fill it down 5,000 rows, done. But copying only works if every reference in the formula moves the way you intend. This lesson explains the three kinds of cell references, relative, absolute and mixed, and shows how to refer to cells on other sheets. If you ever copied a formula and got zeros, wrong totals or #REF! errors, the cause was almost certainly a reference problem.
Relative references: the default
When you write =B2*C2 in D2, Excel does not really remember "cell B2". It remembers a direction: the cell two columns to my left on the same row times the cell one column to my left on the same row. That is a relative reference. When you copy the formula to D3, the same directions now point to B3 and C3. This is exactly what you want for a column of row-by-row calculations.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Product | Units | Price | Revenue |
| 2 | Desk | 14 | 220 | 3080 |
| 3 | Chair | 40 | 85 | 3400 |
| 4 | Lamp | 25 | 32 | 800 |
D2 contains =B2*C2. Copied to D3 it becomes =B3*C3 automatically.
Result: 3400
Copying across works the same way. A formula =B2 copied one column to the right becomes =C2; copied one row down it becomes =B3.
Absolute references: lock a cell with $
Sometimes every row must point to the same cell, for example a commission rate or an exchange rate stored once at the top of the sheet. If you write =B4*B1 and copy it down, the second row becomes =B5*B2, the third =B6*B3, and the results are nonsense. The fix is to add dollar signs: $B$1. The $ before the column letter locks the column; the $ before the row number locks the row. $B$1 is an absolute reference and never changes when copied.
| A | B | C | |
|---|---|---|---|
| 1 | Commission rate | 0.05 | |
| 2 | |||
| 3 | Rep | Sales | Commission |
| 4 | Anna | 18400 | 920.00 |
| 5 | Bruno | 22750 | 1137.5 |
| 6 | Chen | 15900 | 795 |
| 7 | Dina | 27300 | 1365 |
C4 contains =B4*$B$1 and was filled down to C7. B1 holds 5% (shown here as 0.05).
Result: 920.00
Filled down, the formulas read =B5*$B$1, =B6*$B$1, =B7*$B$1: the sales reference moves, the rate stays put. Bruno's commission is 1,137.50 and Dina's is 1,365.00. Change B1 to 6% and all four commissions update at once.
$ is the single most common formula bug in Excel. The first row looks right, so the mistake is easy to miss. After filling a formula down, always click a cell near the bottom and read its formula in the formula bar.The F4 key
You do not have to type dollar signs. While editing a formula, put the cursor in or right after a reference and press F4 (Mac: Cmd+T, or Fn+F4 on some keyboards). Each press cycles through the four possibilities:
| Press F4 | Reference | What stays fixed when copied |
|---|---|---|
| 1st | $B$1 | Column and row (absolute) |
| 2nd | B$1 | Only the row (mixed) |
| 3rd | $B1 | Only the column (mixed) |
| 4th | B1 | Nothing (relative) |
- Click
C4and type=. - Click
B4, type*, then clickB1. - Press
F4once. The formula becomes=B4*$B$1. - Press
Enter, then double-click the fill handle ofC4to copy the formula down. - Click
C7and check the formula bar:=B7*$B$1.
Mixed references
A mixed reference locks only one part. It is the tool for two-way tables, where a formula has to read a value from the top row and a value from the left column. A classic example is a price table: list prices down the side, discount levels across the top, and one formula filling the whole grid.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Price \ Discount | 0.05 | 0.1 | 0.15 |
| 2 | 40 | 38 | 36 | 34 |
| 3 | 75 | 71.25 | 67.5 | 63.75 |
| 4 | 120 | 114 | 108 | 102 |
One formula in B2, =$A2*(1-B$1), copied to B2:D4. Discounts in B1:D1 are 5%, 10%, 15%.
Result: 38
Read the formula carefully. $A2 locks column A, so every copy reads the price from column A, but the row is free to move down. B$1 locks row 1, so every copy reads the discount from the top row, but the column is free to move right. Copy B2 to D4 and the formula there is =$A4*(1-D$1): 120 × 0.85 = 102.
$ goes: ask "when I copy this across, should the column change?" and "when I copy this down, should the row change?". Put a $ in front of every part whose answer is no.References to other sheets
To use a value from another worksheet, write the sheet name, an exclamation mark and the cell: =Rates!B2. If the sheet name contains spaces or special characters, Excel wraps it in single quotes: ='Exchange Rates'!B2. The easiest way to build such a reference is to point at it:
- Click the cell where you want the result and type
=. - Click the tab of the other sheet, for example
Rates. - Click the cell you need, for example
B2. The formula bar shows=Rates!B2. - Type any operator you still need, or press
Enter. Excel returns to the original sheet automatically.
All the rules about $ apply to sheet references too: =B4*Rates!$B$2 keeps pointing to B2 on the Rates sheet when copied.
3-D references: the same cell on many sheets
If a workbook has one sheet per month, all laid out identically, you can add up the same cell across a run of sheets with a 3-D reference: =SUM(Jan:Mar!D10) adds D10 on Jan, every sheet between, and Mar. If you insert a new sheet between Jan and Mar, it is included automatically. Only some functions accept 3-D references (SUM, AVERAGE, COUNT, MAX, MIN and a few others).
References to other workbooks
A reference to another file looks like =[Budget.xlsx]Costs!$C$5. When the other file is closed, Excel shows the full path. These external links are fragile: if the source file is renamed or moved, the link breaks. Use Data › Queries & Connections › Edit Links (older versions: Data › Connections › Edit Links) to see, update or break links. For regular imports, Power Query is a sturdier option, see Power Query basics: import, clean, append, merge, refresh.
What happens when you insert, delete or move cells
- Inserting rows or columns: references adjust so they still point to the same data.
=SUM(B2:B10)becomes=SUM(B2:B11)if you insert a row inside the range. - Deleting a cell a formula depends on: the reference becomes
#REF!, which cannot be repaired automatically. Undo withCtrl+Zstraight away. - Cutting and pasting (moving) a cell: formulas follow it to its new position. Copying does not.
[@Sales] that are easier to read and do not need dollar signs. See Excel tables and structured references.R1C1 style, briefly
If your column headings suddenly show numbers instead of letters, the R1C1 reference style has been switched on (File › Options › Formulas › R1C1 reference style). In that style, R[1]C[-2] means one row down and two columns left. It shows clearly how relative references really work, and VBA code often uses it, but for daily work switch it off again.
Check yourself
1. You copy =A2*B1 from C2 down to C3. What does C3 contain?
Both references are relative, so both move down one row.
2. Which reference stays exactly the same wherever you copy it?
Dollar signs before both the column and the row make the reference absolute.
3. In a multiplication table the formula in B2 is =$A2*B$1. What is the formula after copying it to D5?
Column A is locked and row 1 is locked; the free parts move to row 5 and column D.
4. How do you write a reference to cell B2 on a sheet called Exchange Rates?
Sheet names with spaces must be enclosed in single quotes, followed by !
5. What does pressing F4 do while editing a reference?
In edit mode F4 toggles the $ signs. Outside edit mode it repeats the last action.