Sub topic 6
How references change when you copy, fill, or move
This chapter explains what happens to the cell references inside a formula when you copy, fill, or move it. It assumes you can enter simple formulas, select ranges, and use copy, cut, and paste. Once you can predict the result, you can build one formula and reuse it across a whole sheet.
The working model
Every reference in a formula points at a cell. Excel stores a reference in one of two ways, depending on the kind of operation you perform:
- When you copy or fill a formula, Excel treats each reference as an offset from the formula's own cell. Moving the formula moves the target by the same offset.
- When you cut and paste a formula, Excel treats each reference as a fixed address. The formula moves, and its references stay the same.
Reference style decides how a copied reference behaves:
| Style | Example | Behavior when copied or filled |
|---|---|---|
| Relative | `B2` | Column and row both shift |
| Absolute | `$B$2` | Neither shifts |
| Mixed, column locked | `$B2` | Row shifts, column stays |
| Mixed, row locked | `B$2` | Column shifts, row stays |
The $ sign locks whatever follows it. In $B2, the $ is before B, so the column is locked. In B$2, the $ is before 2, so the row is locked.
Relative references when you fill down
Suppose column B holds prices, and cell E1 holds a tax rate. You want a total in column C for each price.
C2: =B2*$E$1
C3: =B3*$E$1You type the first formula in C2, then fill it down to C3. The relative reference B2 shifts one row down and becomes B3. The absolute reference $E$1 does not change, so every row still uses the same tax rate.
If you had typed =B2*E1 and filled down, C3 would contain =B3*E2. E2 is probably empty, so C3 would show 0. This is the most common reference mistake in worksheets.
Copy versus cut
Copy and cut look similar, but they treat references differently.
Before: D2 contains =B2+C2
Copy D2 to D3 gives: =B3+C3
Cut D2 and paste to F2 gives: =B2+C2When you copy D2 to D3, the formula moves one row down, so B2 and C2 become B3 and C3. When you cut D2 and paste it to F2, Excel moves the formula as it is. It still adds B2 and C2, even though it now lives in column F.
Use this rule to choose:
- Copy when you want the same calculation applied to a different row or column.
- Cut when you want to relocate a calculation and keep its inputs the same.
What happens to formulas that point at moved cells
Cutting also affects formulas that refer to the cell you moved. If E2 contains =D2*2 and you cut D2 and paste it to F2, Excel updates E2 to =F2*2. The dependent formula follows the data.
Copying does not do this. If you copy D2 to F2, E2 still points at D2, because the original cell is still there.
Dragging to move
Dragging a selection by its border is the same as cut and paste. References inside the moved formula stay fixed, and formulas elsewhere that point at the moved cells are updated. Holding Ctrl while you drag turns the drag into a copy.
Mixed references
Mixed references let you fill a formula in two directions with one entry. A multiplication table is the classic example. Put the numbers 1 to 5 in A2:A6 and in B1:F1.
B2: =$A2*B$1Fill B2 right to F2 and then down to row 6. The column of $A2 is locked, so the formula always reads the number from column A. Its row is relative, so it follows the current row. In B$1, the row is locked, so the formula always reads the number from row 1, and its column is relative.
For example, D4 contains =$A4*D$1. Each cell multiplies its row header by its column header.
You can cycle through the four styles while editing a formula. Put the cursor in or next to a reference and press F4. Each press moves through $B$2, B$2, $B2, and B2. On some laptops you need Fn+F4.
How a reference is shifted: a worked trace
Here is a full example that combines both styles. A sheet has quantities in column B, unit prices in column C, and a discount in G1.
D2: =B2*C2*(1-$G$1)Fill D2 down to D4, and the results are:
| Cell | Formula |
|---|---|
| D2 | `=B2*C2*(1-$G$1)` |
| D3 | `=B3*C3*(1-$G$1)` |
| D4 | `=B4*C4*(1-$G$1)` |
Now copy D2 to E2. The formula moves one column right, so every relative reference shifts one column right:
E2: =C2*D2*(1-$G$1)This result is wrong for the sheet's purpose, since E2 now multiplies price by the total. Excel did exactly what the rule says. The error came from copying across when the formula was designed for filling down. Check the direction of the copy against the layout of your data.
Copying a formula with references to other sheets
References to other sheets follow the same rules. In =Sheet2!B2*$E$1, the B2 part shifts when you copy and Sheet2! stays. A 3D reference or a range such as Sheet2!B2:B10 shifts as a whole range. Copying a formula to another sheet does not add a sheet name to its references. A relative reference without a sheet name then points at the same address on the new sheet. Check these formulas after pasting.
Ranges shift too
A range reference shifts every end of the range. If D12 contains =SUM(D2:D11) and you copy it one column right, the result is =SUM(E2:E11). This is useful for column totals.
If a range should stay anchored at one end, lock only that end. A running total uses this pattern:
C2: =SUM($B$2:B2)
C3: =SUM($B$2:B3)
C4: =SUM($B$2:B4)The start of the range is locked at $B$2. The end is relative, so the range grows by one cell with each row.
Edge cases and errors
- Shifting off the sheet. If a copied relative reference would point above row 1 or left of column A, Excel shows
#REF!. Copying=A1into row 2 of a column to its left, for example, has no valid target for the shifted cell. - Inserting rows. When you insert a row inside a referenced range, Excel expands the range. Inserting a row above an absolute reference such as
$E$1moves the reference to$E$2, so it still points at the same data. - Deleting referenced cells. Deleting a cell that a formula uses turns that reference into
#REF!. Cutting and pasting over it has the same effect. - Pasting over a cut target. If you paste cut cells onto cells that other formulas refer to, those formulas point at the new content, which can change their results without any warning.
- Text copies of formulas. If a cell is formatted as Text before you type a formula, Excel stores the formula as plain text and never calculates it. Fill then repeats the same text.
- Calculation mode. If the workbook is set to manual calculation, filled formulas can show old values until you press F9.
A checklist for predicting the result
- Decide whether you are copying (or filling) or cutting (or dragging).
- If you are cutting, references inside the formula do not change. Dependent formulas elsewhere update.
- If you are copying, count how many rows and columns the formula moves.
- Apply that offset to each reference that has no
$in the affected part. - Leave any part that follows a
$unchanged.
Exercise
Cell C2 contains =B2*D$1. You copy C2 to E4. What formula does E4 contain?
Show answer
E4 contains =D4*F$1. The formula moves two columns right and two rows down. B2 is fully relative, so it becomes D4. In D$1 the column is relative, so D becomes F, and the row is locked, so it stays 1.
Exercise
D5 contains =B5+C5. You cut D5 and paste it into H9. What does H9 contain, and what happens to a formula in E5 that was =D5*2?
Show answer
H9 contains =B5+C5, because cutting keeps references fixed. The formula in E5 updates to =H9*2, because Excel adjusts formulas that refer to a cell you move.
Exercise
You enter =B2*E1 in C2 to apply a tax rate stored in E1, then fill down to C10. C3 shows a wrong result. What went wrong, and how do you fix it?
Show answer
E1 is relative, so C3 contains =B3E2, which points at an empty cell. Edit C2 to =B2$E$1 (press F4 while the cursor is on E1) and fill down again.