Sub topic 6
Mixed References: Locking Only the Row or the Column
Assume you can enter values and formulas in Google Sheets, use A1 notation such as A1, and apply basic arithmetic operators. This chapter explains how to keep only one part of a cell reference fixed while copying a formula.
A mixed reference combines a relative part with an absolute part:
$A2locks column A, but lets the row change.A$2locks row 2, but lets the column change.$A$2locks both the column and the row.A2leaves both parts relative.
The dollar sign tells Sheets which part must not move when the formula is copied.
Why mixed references matter
Suppose a table has row labels in column A and column labels in row 1. Each interior cell should multiply its row label by its column label.
| Row | B | C | D |
|---|---|---|---|
| 1 | 10 | 20 | 30 |
| 2 | 2 | ||
| 3 | 3 |
The formula in B2 must use the value in A2 and the value in B1. When copied right, the row label must remain in column A, while the column label must move from B1 to C1 and then D1. When copied down, the column label must remain in row 1, while the row label must move from A2 to A3.
Use this formula in B2:
=$A2*B$1$A2 keeps column A fixed and changes the row. B$1 keeps row 1 fixed and changes the column.
How the reference moves
The same formula produces different references in different cells:
| Formula location | Formula after copying | Meaning |
|---|---|---|
| B2 | `=$A2*B$1` | A2 multiplied by B1 |
| C2 | `=$A2*C$1` | A2 multiplied by C1 |
| B3 | `=$A3*B$1` | A3 multiplied by B1 |
| C3 | `=$A3*C$1` | A3 multiplied by C1 |
Copy B2 across and down to fill the table. The column lock on $A2 prevents the row label from shifting into columns B, C, or D. The row lock on B$1 prevents the column label from shifting into rows 2, 3, or 4.
Building the table
- Enter row labels in
A2:A5, such as 2, 3, 4, and 5. - Enter column labels in
B1:E1, such as 10, 20, 30, and 40. - Select
B2and enter=$A2*B$1. - Press Enter.
- Copy
B2across to column E. - Select the filled row and copy it down through row 5.
You can use the fill handle, which is the small square at the lower-right corner of the selected cell. You can also use copy and paste. Double-clicking the fill handle can autofill down when the adjacent column contains a continuous list.
Editing mixed references
You can type dollar signs directly into a formula. You can also place the cursor inside a reference and press F4 to cycle through reference types. Depending on the keyboard or browser, you may need Fn+F4.
A repeated press commonly cycles through these forms:
A1
$A$1
A$1
$A1Check the result in the formula bar. Keyboard behavior can vary, so typing the dollar signs is the reliable fallback.
> callout note > Before copying, ask which direction each part should move. If the formula moves across columns, decide whether the column should change. If it moves down rows, decide whether the row should change.
Common errors
If every result in a row uses the same row label, you may have locked both parts, as in $A$2. Use $A2 when the row must change.
If every result in a column uses the same column label, you may have locked both parts of the header, as in $B$1. Use B$1 so the column can change.
If results refer to unrelated cells, inspect the formula in the first copied cell. A missing dollar sign often causes a reference to drift. Test one cell at a time and compare its row and column with the intended labels.
Exercise
In B2, row labels are in A2:A4 and column labels are in B1:D1. What formula should you enter so it can be copied across and down?
Show answer
Enter =$A2*B$1. The dollar sign before A locks the column, and the dollar sign before 1 locks the row.