Sub topic 6
Mixed references: locking only the row or the column
What this chapter assumes
You should already know how to enter a formula in a Google Sheets cell and read A1 addresses such as B2. You should also know that a relative reference changes when you copy a formula, and that $A$1 locks both parts of an address. This chapter covers the case in between, where you lock one part and leave the other free.
What a mixed reference is
A cell address has two parts: a column letter and a row number. The dollar sign locks whichever part comes right after it. A mixed reference has a dollar sign on one part only.
$A2locks the column and leaves the row free. The formula can move down, and the row number changes. The column stays A.A$2locks the row and leaves the column free. The formula can move across, and the column letter changes. The row stays 2.
The following table lists all four forms. It shows what each becomes when you copy the formula from B2 one column right (to C2) or one row down (to B3).
| Written in B2 | Name | Copied right to C2 | Copied down to B3 |
|---|---|---|---|
| `A1` | Relative | `B1` | `A2` |
| `$A$1` | Absolute | `$A$1` | `$A$1` |
| `$A1` | Mixed, column locked | `$A1` | `$A2` |
| `A$1` | Mixed, row locked | `B$1` | `A$1` |
Read the last two rows carefully. In $A1, the locked column never moves, but the row still follows the formula downward. In A$1, the locked row never moves, but the column still follows the formula sideways.
How the shift is calculated
Sheets does not copy the text of a formula. It remembers the offset between the formula cell and each cell it refers to, then rebuilds the reference from the new location. The dollar signs switch off that rebuilding for one axis.
Take =$A2*B$1 in C3. Sheets reads it as follows:
$A2is the column A, and the row is one row above the formula's own row.B$1is one column left of the formula's own column, and the row is fixed at 1.
Copy the formula to E5, which is two columns right and two rows down. The first reference keeps column A and moves down two rows, so it becomes $A4. The second reference moves two columns right and keeps row 1, so it becomes D$1. The new formula is =$A4*D$1.
Worked example: a discount grid
A shop wants to see the sale price of each product at three discount levels. The base prices run down column A and the discount rates run across row 1.
| Row | A | B | C | D |
|---|---|---|---|---|
| 1 | Price | 5% | 10% | 15% |
| 2 | 100 | |||
| 3 | 200 | |||
| 4 | 400 |
Enter the rates as real percentages, so B1 holds 0.05 (or 5%), C1 holds 0.1, and D1 holds 0.15. In B2, type the following formula:
Cell B2: =$A2*(1-B$1)Each reference has a job:
$A2always reads the price from column A. The row must follow the formula, because row 3 needs the price inA3.B$1always reads the rate from row 1. The column must follow the formula, because column C needs the rate inC1.
Now copy B2, select B2:D4, and paste. You can instead drag the fill handle right to D2, then drag the whole row down to row 4. The formula in D4 is:
Cell D4: =$A4*(1-D$1)The finished grid is:
| Row | A | B | C | D |
|---|---|---|---|---|
| 1 | Price | 5% | 10% | 15% |
| 2 | 100 | 95 | 90 | 85 |
| 3 | 200 | 190 | 180 | 170 |
| 4 | 400 | 380 | 360 | 340 |
One formula produced nine correct results. With only relative references, you would write three separate formulas, one per column. With only absolute references, you would write nine.
What goes wrong when the dollar signs are misplaced
Mixed references fail quietly. Sheets accepts every variant and returns numbers, so you see no error. These are the three common mistakes, each shown on the grid above.
No locks at all. The formula =A2*(1-B1) is correct in B2. After filling right, C2 holds =B2*(1-C1). That multiplies the 95 you just calculated by something that is not a rate, because C1 is a rate but B2 is no longer a price. After filling down, B3 holds =A3*(1-B2), and B2 is a price, not a rate. The numbers look plausible and are wrong.
The locks are swapped. The formula =A$2*(1-$B1) has the dollar signs on the wrong axes. Filled across, it keeps reading column B for the rate. Filled down, it keeps reading row 2 for the price. Every cell in the grid ends up using the same price or the same rate in a pattern that does not match the headers.
Only one reference is locked. If you write =$A2*(1-B1), the price is right but the rate drifts down off the header row. In B3 the formula reads B2 as the rate, which is a price, and a result such as 200*(1-95) is -18800. Large negative or odd results are the typical sign.
A quick way to catch these mistakes is to click the last cell of the grid and read its formula. In a correct grid, D4 should refer to A4 and D1. If it refers to some other cell, the locks are wrong.
Mixed references in ranges
A range such as B2:B10 has two endpoints, and each endpoint can have its own dollar signs. This gives you ranges that start in a fixed place and grow as you fill down. A running total is the standard example.
Suppose column B holds monthly sales in B2:B13, and you want the total so far in column C:
Cell C2: =SUM(B$2:B2)
Cell C3 (after fill down): =SUM(B$2:B3)
Cell C4 (after fill down): =SUM(B$2:B4)The start of the range is B$2, so it stays on row 2. The end of the range is B2, which is relative, so it moves down one row each time. The range grows by one cell per row. Using $B$2:B2 gives the same result here, because you only fill down. The B$2 form stays correct if you later copy the formula into the next column to total another measure.
Edge cases to know
Copy versus cut. Mixed references matter when you copy and paste, fill, or autofill. They do not matter when you cut and paste. If you cut B2 and paste it into F8, the formula text does not change at all, because the formula is being moved, not copied. Sheets also keeps references pointing at the same cells when other cells are moved.
Filling in only one direction. If you only ever fill down, a column lock such as $A2 makes no visible difference to the results, because the column would not change anyway. It still protects you if you copy the formula sideways later. If you never expect that, a plain relative reference is fine. Add the lock when the formula is meant to be reused in two directions.
Inserting rows and columns. Dollar signs do not stop Sheets from updating a reference when you insert or delete rows or columns. If you insert a new row above row 1 in the discount grid, B$1 becomes B$2, and it still points at the header. The lock controls copying, not structural edits.
Header cells that change type. If a header holds text such as "5%" typed as a string, (1-B$1) returns #VALUE!. The reference is correct, but the cell content is not a number. Check that the cell is aligned to the right, which is the default for numbers, before you blame the formula.
Whole-row and whole-column references. A reference like $A:$A or 1:1 follows the same lock rules for its own axis. A:A copied right becomes B:B, while $A:$A does not move. Use the lock when a formula copied sideways must keep reading column A.
Choosing between the four forms
Use this as a decision list for each reference in a formula you plan to copy:
- If it should follow the formula in both directions, leave it relative:
A1. - If it must always point at one cell, lock both parts:
$A$1. - If it comes from a column of labels or values, and the formula will be copied across, lock the column:
$A1. - If it comes from a row of labels or values, and the formula will be copied down, lock the row:
A$1.
Rules 3 and 4 are the typical pair in a grid. One input lives down the left side and one across the top, so one reference locks the column and the other locks the row.
The next chapters build on this. The multiplication table chapter uses the same pairing in a different setting. The chapter on toggling reference types shows how to cycle through these four forms with the F4 key instead of typing each dollar sign by hand.
Exercise
In cell B2 you write =A$2*$B1 and then copy it to D4 (two columns right and two rows down). What formula does D4 hold?
Show answer
=C$2*$B3. The first reference, A$2, has its row locked, so the row stays 2 and the column moves two to the right, from A to C. The second reference, $B1, has its column locked, so the column stays B and the row moves two down, from 1 to 3.
Exercise
A sheet has unit prices in B2:B20 and quantities for three months in C1:E1 headed "Jan", "Feb", "Mar" (the quantities themselves are in C2:E20). In G2 you want revenue per product using a single discount rate in the single cell H1, and you plan to copy the formula across G2:I20 in the same layout as the quantities. Write a formula for G2 that fills correctly across and down.
Show answer
=$B2C2(1-$H$1). The price reference $B2 locks column B, so every column uses the same price while the row follows. The quantity C2 is fully relative, so it moves to D2, E2 and down to the matching row. The discount $H$1 is absolute because it is one fixed cell that must never move. The result uses no row-only lock, because no header row needs to stay fixed.
Exercise
You fill =SUM(B$2:B2) down column C from row 2. What formula appears in C6, and what does it add up?
Show answer
=SUM(B$2:B6). It adds the values in B2 through B6, a running total of five rows. The start of the range stays on row 2 because of the row lock, and the end of the range moves down with the formula.