Sub topic 3
Relative references: why copied formulas change
This chapter assumes you can enter values and formulas in a Google Sheets cell, read addresses such as A1 and B2, and use basic arithmetic operators. Earlier chapters covered cell references and the ways to copy a formula. Here you learn the working model behind what happens to a reference when a formula moves. Most "my formula broke when I copied it" problems come from this behavior.
The working model: a reference is a direction, not an address
When you type =A2*0.2 in cell B2, it looks like you are pointing at cell A2. Sheets actually stores something closer to this: "the cell in the same row, one column to the left." That is a relative reference. It describes where the target sits compared with the cell holding the formula.
When you copy the formula to another cell, Sheets keeps the direction and recalculates the address. The formula in B3 points to the cell in the same row, one column to the left, which is A3.
This is the default behavior of every reference you type without a $ sign. It is useful because most spreadsheets repeat one calculation on many rows. You write the formula once and copy it, and each copy works on its own row.
Cell B2: =A2*0.2
Cell B3 (after fill down): =A3*0.2Each row now multiplies its own price by 0.2. You did not edit the second formula. Sheets did.
The shift rule
The adjustment follows a simple rule. Count how far the formula moved, then move every relative reference by the same amount.
| Move of the formula | Effect on a relative reference | Example: `=A2*0.2` becomes |
|---|---|---|
| One row down | Row number rises by 1 | `=A3*0.2` |
| Five rows down | Row number rises by 5 | `=A7*0.2` |
| One column right | Column letter moves one step | `=B2*0.2` |
| One row up | Row number falls by 1 | `=A1*0.2` |
| One column left | Column letter moves one step back | `=#REF!*0.2` if it would pass column A |
The last row of the table shows a limit. If the shift would push a reference off the edge of the sheet, for example to column 0 or row 0, the result is a #REF! error.
Every part of the formula follows this rule independently. A formula with three references has three targets, and each one shifts by the same distance.
Cell D2: =A2+B2*C2
Cell D3 (after fill down): =A3+B3*C3
Cell E2 (after copy right from D2): =B2+C2*D2The last line is worth studying. Copying right moved every reference one column over, so the formula in E2 now includes D2, which holds the original formula. This is correct behavior and sometimes causes a circular dependency or a nonsense result. Always check where the formula lands before you copy it sideways.
Seeing it happen
The fastest way to build a feel for the rule is to watch it. Try this in an empty sheet.
- In A2:A5, enter the prices 10, 20, 30 and 40.
- In B2, enter
=A2*0.2. - Select B2 and drag the small square at its bottom-right corner (the fill handle) down to B5.
- Click each of B3, B4 and B5 and read the formula in the formula bar.
You should see =A3*0.2, =A4*0.2 and =A5*0.2. The results are 4, 6 and 8 for B3:B5, with 2 in B2.
Now try the same with a copy and paste. Select B2, press Ctrl+C (Cmd+C on Mac), select B4, and press Ctrl+V. The formula in B4 reads =A4*0.2. The result matches the fill handle, because both actions use the same shift rule. The distance moved is two rows, so A2 becomes A4.
Cut and paste is different
Copy and cut look similar, but they treat references differently.
- Copy and paste applies the shift rule to the formula you paste.
- Cut and paste (move) keeps the formula exactly as it was. Sheets assumes you want the same calculation in a new place, so the references still point at the original cells.
If you cut B2 and paste it into D10, the formula stays =A2*0.2. Sheets also updates any other formula that referred to B2, so it now refers to D10.
This difference explains many surprises. If a formula keeps its old references after you moved it, you probably cut it. If it changed references, you copied it.
Relative references inside ranges
A range such as A2:A10 has two corners, and each corner shifts on its own.
Cell C2: =SUM(A2:A4)
Cell C3 (after fill down): =SUM(A3:A5)Both corners moved down by one row, so the range slid down and still covers three cells. This is the behavior you want for a rolling total, such as a three-day moving sum, where each row sums the three rows starting at its own position.
It is not what you want for a grand total over a fixed list. A formula such as =SUM(A2:A10) copied down becomes =SUM(A3:A11), then =SUM(A4:A12), and the range drifts away from the data. Locking ranges is the topic of a later chapter. For now, recognize the drift as a sign that a reference should have been absolute.
A common deliberate use is a running total, where only one corner needs to stay put. Mixed references, covered later, handle that case.
What happens when the target is not a data cell
The shift rule has no idea what your cells mean. It moves references mechanically, even when the target should not move. This is the central weakness of relative references.
Suppose you place a tax rate of 0.2 in E1 and write the formula so that it refers to E1 directly:
Cell E1: 0.2 (tax rate)
Cell B2: =A2*E1
Cell B3 (after fill down): =A3*E2The price reference should shift, since each row has its own price. The rate reference should not shift, since there is only one rate. Under the shift rule, both references move down one row. B3 now multiplies by E2, which is empty.
An empty cell counts as 0 in arithmetic, so B3 shows 0 and no error appears. The sheet looks as if it works. Only checking the formula bar or the numbers reveals the mistake. This silent failure is the main reason to learn the next tool: the absolute reference, which stops a reference from shifting.
Predicting the result before you copy
Build the habit of asking three questions before you fill or paste a formula.
- Which references in this formula point at something that belongs to this row or column? These should be relative.
- Which references point at one shared cell, such as a rate, a date, or a threshold? These must not shift.
- How far and in which direction will the formula move?
If every reference answers "belongs to this row or column," the plain formula with no $ is correct. If any reference answers "one shared cell," you need to lock it, which is the next chapter's subject.
Here is a worked check. You have quantities in B2:B20 and unit prices in C2:C20, and you want a line total in D2:D20.
Cell D2: =B2*C2Both references belong to their own row. Copying down by one row gives =B3*C3, =B4*C4, and so on. No shared cell is involved, so no locking is needed.
Now add a discount percentage in G1 that applies to every row.
Cell D2: =B2*C2*(1-G1)Here G1 is a shared cell. Filling down turns it into G2, G3, and so on, which is wrong. Both B2 and C2 are fine, but G1 needs locking.
Double-click autofill and its stopping rule
The fill handle also responds to a double-click. Instead of dragging, you double-click the square and Sheets fills the formula down as far as the neighboring column has data.
The shift rule is the same. The only difference is how Sheets chooses the last row. It looks at the column to the left and fills until that column ends at the first blank cell. Two cases cause trouble:
- If the neighboring column has a gap, the fill stops at the gap and leaves the rest empty.
- If the neighboring column is empty, nothing fills at all, because there is no data to follow.
When a fill stops early, scroll to the end of the data and check that the last row has a formula.
Common errors with relative references
| Symptom | Likely cause | What to check |
|---|---|---|
| Results are 0 for all rows but the first | A shared cell reference drifted onto empty cells | Read the formula in the second row |
| Result is correct in row 2 and wrong afterward | A reference that should be fixed is relative | Look for a rate, date or lookup range |
| `#REF!` appears after copying left or up | The shift went past the edge of the sheet | Check the move direction and distance |
| A total range covers the wrong rows | Both range corners shifted | Lock the range in a later step |
| Formula did not change after moving it | You cut and pasted instead of copying | Use copy if you wanted the shift |
| Fill stops partway down | The neighboring column has a blank cell | Fill the rest manually or fix the gap |
Summary of the model
A relative reference stores a direction from the formula's own cell. Copying or filling a formula moves the formula, and every relative reference moves by the same distance. This works well when each copy should act on its own row or column. It fails quietly when one reference should stay on a shared cell. Cut and paste is the exception, because it moves a formula without changing its references.
Exercise
Cell C2 contains =A2+B2*$E$1... wait, ignore the dollar signs and consider the formula =A2+B2*E1 in cell C2. You copy C2 to cell D4, which is two rows down and one column right. What formula does D4 contain, and what is wrong with it if E1 holds a shared tax rate?
Show answer
Every reference moves two rows down and one column right. A2 becomes B4, B2 becomes C4, and E1 becomes F3. So D4 contains =B4+C4*F3. The tax rate reference E1 should stay on the shared cell, but it drifted to F3, which is probably empty and counts as 0. The rate reference needs locking with $, which you will learn next.
Exercise
You enter =SUM(B2:B4) in C2 and fill it down to C4. What formulas appear in C3 and C4, and what kind of calculation do they perform?
Show answer
C3 contains =SUM(B3:B5) and C4 contains =SUM(B4:B6). Each formula sums three cells starting at its own row, so the range slides down like a window. This suits a rolling total over a fixed number of rows. It does not suit a grand total over a fixed list, where the range would need to be locked.