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.

Beginner 16 min read

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.

D3fx=B3*C3
ABCD
1ProductUnitsPriceRevenue
2Desk142203080
3Chair40853400
4Lamp2532800

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.

C4fx=B4*$B$1
ABC
1Commission rate0.05
2
3RepSalesCommission
4Anna18400920.00
5Bruno227501137.5
6Chen15900795
7Dina273001365

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.

Watch out. Forgetting the $ 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 F4ReferenceWhat stays fixed when copied
1st$B$1Column and row (absolute)
2ndB$1Only the row (mixed)
3rd$B1Only the column (mixed)
4thB1Nothing (relative)
  1. Click C4 and type =.
  2. Click B4, type *, then click B1.
  3. Press F4 once. The formula becomes =B4*$B$1.
  4. Press Enter, then double-click the fill handle of C4 to copy the formula down.
  5. Click C7 and 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.

B2fx=$A2*(1-B$1)
ABCD
1Price \ Discount0.050.10.15
240383634
37571.2567.563.75
4120114108102

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.

Tip. A quick way to decide where the $ 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:

  1. Click the cell where you want the result and type =.
  2. Click the tab of the other sheet, for example Rates.
  3. Click the cell you need, for example B2. The formula bar shows =Rates!B2.
  4. 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 with Ctrl+Z straight away.
  • Cutting and pasting (moving) a cell: formulas follow it to its new position. Copying does not.
Tip. Excel tables use structured references such as [@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?

2. Which reference stays exactly the same wherever you copy it?

3. In a multiplication table the formula in B2 is =$A2*B$1. What is the formula after copying it to D5?

4. How do you write a reference to cell B2 on a sheet called Exchange Rates?

5. What does pressing F4 do while editing a reference?

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 16 KB