Sub topic 4
What Happens When You Copy or Fill a Formula
This chapter assumes you can enter values, use basic arithmetic operators, and write simple Google Sheets formulas. You will learn how cell references change when you copy or fill a formula into another cell.
Relative references follow the formula
A cell reference is the address of a cell, such as B2. In a formula, a relative reference changes according to the formula's new position.
Suppose a sheet records product quantities and prices:
| A | B | C | D |
|---|---|---|---|
| Product | Quantity | Price | Total |
| Notebook | 3 | 4.00 | |
| Pen | 5 | 1.50 |
In D2, enter:
=B2*C2The formula multiplies the quantity by the price. It returns 12, because 3 * 4 is 12.
When you fill D2 down into D3, Sheets changes the references by one row:
=B3*C3The copied formula returns 7.5, using the values from row 3. This behavior is useful when every row uses the same calculation.
You can copy a formula by selecting the cell, pressing Ctrl+C or Cmd+C, selecting the destination, and pressing Ctrl+V or Cmd+V. You can also drag the small square at the lower-right corner of the selected cell. This square is called the fill handle.
Absolute references stay fixed
Sometimes a calculation needs one constant cell. For example, place a tax rate of 0.08 in F1. To calculate a taxed total in E2, enter:
=B2*C2*(1+$F$1)The dollar signs make F1 an absolute reference. When you fill the formula down, B2 and C2 become B3 and C3, but $F$1 remains unchanged.
| Reference | When copied down | When copied right |
|---|---|---|
| `B2` | Changes to `B3` | Changes to `C2` |
| `$F$1` | Stays `$F$1` | Stays `$F$1` |
| `$A2` | Changes to `$A3` | Stays in column A |
| `B$1` | Stays in row 1 | Changes to `C$1` |
Mixed references control one direction
A mixed reference locks either the column or the row.
$A2locks column A but lets the row change.B$1locks row 1 but lets the column change.
For a multiplication table, put labels across row 1 and down column A. In B2, use:
=$A2*B$1When you fill this formula right and down, the reference to the row label stays in column A, while the column header stays in row 1. This lets one formula create the whole table.
Check copied formulas for errors
A copied formula can point to the wrong row or column if the original formula is incorrect. Select each result and inspect the formula bar. Confirm that the references match that result's row.
A #REF! error means a reference is invalid, often because a referenced row or column was deleted. Restore the missing range or edit the formula to use a valid address.
Practice
Exercise
In D2, write a formula that multiplies B2 by the tax rate in F1, then fill it down. Which reference must be absolute?
Show answer
Use =B2*$F$1. B2 should change to B3, B4, and so on. F1 must remain fixed, so use $F$1.