Sub topic 3
Relative References: Formulas That Follow Their Position
This chapter assumes you can open and edit a Google Sheets spreadsheet, enter values into cells, and use basic arithmetic operators such as +, -, *, and /.
A relative reference is a cell reference that changes when you copy or fill a formula. The reference stays in the same position relative to the formula. This lets one formula perform the same kind of calculation for many rows.
A formula follows the row
Suppose a sheet contains this data:
| A | B | C | D |
|---|---|---|---|
| Item | Quantity | Price | Total |
| Notebook | 3 | 4 | |
| Pen | 5 | 2 |
To calculate the notebook total, select cell D2 and enter:
=B2*C2The equals sign tells Google Sheets that the entry is a formula. The formula multiplies the quantity in B2 by the price in C2, producing 12.
The references B2 and C2 are relative. They describe positions two columns to the left of D2 and one row down. When you copy the formula from D2 to D3, Google Sheets changes the references to match the new position:
=B3*C3The pen total becomes 10. You wrote the calculation once, then reused its relative pattern.
Copying and filling formulas
You can copy a formula with keyboard shortcuts, or drag the small square at the lower-right corner of the selected cell. This square is called the fill handle.
To fill the total column:
- Enter
=B2*C2in D2. - Select D2.
- Drag the fill handle down to D3.
- Check that D3 contains
=B3*C3.
You can also double-click the fill handle when the neighboring column contains continuous data. Google Sheets fills the formula down to match that data.
Relative references adjust when you copy or fill a formula. They also usually adjust when you cut and paste a formula to another location. This behavior is useful for row-by-row calculations such as totals, differences, and percentages.
Predicting the new reference
Before copying a formula, describe each reference by its distance from the formula cell.
For =B2*C2 in D2:
- B2 is two columns left and in the same row.
- C2 is one column left and in the same row.
In D3, those same relationships point to B3 and C3. If you copy the formula one column right, the references move one column right as well.
| Formula location | Formula | Result |
|---|---|---|
| D2 | `=B2*C2` | 12 |
| D3 | `=B3*C3` | 10 |
A common error is filling a formula across or down without checking the first copied result. Select the new cell and read the formula bar. Confirm that each reference points to the intended row or column before filling a large range.
Exercise
Cell E2 contains =C2-D2. What formula should appear in E5 after you fill the formula down from E2?
Show answer
=C5-D5, because both relative references move three rows down.