Sub topic 7
Toggling reference types quickly
This chapter assumes you already know how to enter formulas in Google Sheets, read addresses such as B2, and use the four basic arithmetic operators. It also assumes you have seen the three reference types: relative (A2), absolute ($A$2), and mixed ($A2 or A$2). Here you will learn to switch a reference between those types without retyping it, and to avoid the errors that come from doing so.
Why toggling matters
Every reference in a formula is stored as text. The only difference between A2, $A$2, A$2 and $A2 is where the dollar signs sit. Typing the signs by hand works, but it is slow and easy to get wrong. A missing $ is one of the most common causes of wrong results after a formula is copied.
Google Sheets gives you a shortcut. While you edit a formula, you can press a key to cycle the reference under your cursor through all four types. You get the same result as typing the signs, in one keystroke.
The four states of a reference
A single cell reference can be in one of four states:
| State | Example | Column when copied | Row when copied |
|---|---|---|---|
| Relative | `A2` | Moves | Moves |
| Absolute | `$A$2` | Locked | Locked |
| Mixed, row locked | `A$2` | Moves | Locked |
| Mixed, column locked | `$A2` | Locked | Moves |
The $ sign always locks the part that comes right after it. $A locks the column letter. $2 locks the row number. Read each reference left to right and ask of each $: "what does this lock?"
The F4 shortcut
Press F4 while the cursor is on or inside a reference in edit mode. Each press moves the reference to the next state in a fixed cycle:
A2(relative) becomes$A$2(absolute).$A$2becomesA$2(row locked).A$2becomes$A2(column locked).$A2becomesA2(relative again).
The cycle then repeats.
Because the cycle has four stops, you can reach any state in at most three presses from the one you are on. If you overshoot, keep pressing until it comes around.
How to use it step by step
- Select the cell and press Enter or F2, or double-click it, to enter edit mode. You can also start typing a formula with
=. - Click inside the reference you want to change, or place the text cursor next to it. You can also select the whole reference text.
- Press F4.
- Watch the formula bar. Stop pressing when the signs are where you want them.
- Press Enter to commit.
Example: you have typed =A2*E1 in B2 and need E1 locked. Put the cursor inside E1 and press F4 once. The formula becomes =A2*$E$1. Pressing F4 again gives =A2*E$1, which is a different formula with different copy behavior.
Pointing and F4 together
If you build a formula by clicking cells instead of typing addresses, the reference is inserted as relative. Click the cell, then press F4 immediately, before you type the next operator. At that moment the reference you just inserted is the one the key acts on.
Type: =A2*
Click: E1 -> formula shows =A2*E1
Press: F4 -> formula shows =A2*$E$1
Press: EnterIf F4 does nothing
The shortcut is not the same on every device. These are the usual causes and fixes:
- Laptop function keys. Many laptops need the function key held, so use Fn + F4. Some set the F-row to media controls by default.
- Mac. Browsers on macOS often use the F-row for brightness or volume. Try Fn + F4. Google also lists Cmd + T as an alternative in some versions of the shortcut list. If neither works, type the signs by hand.
- Not in edit mode. F4 only acts on a reference inside a formula you are editing. Selecting a cell without editing does nothing useful.
- No cursor in a reference. If the cursor sits on an operator or a space, there is no reference to change.
- Browser or system capture. Some browsers, remote desktops and virtual machines intercept F4. In that case, type the dollar signs.
Because shortcut behavior can vary between versions and platforms, treat F4 as a convenience and keep typing $ as the fallback that always works.
Typing the signs by hand
You can type a dollar sign anywhere inside a reference. Sheets does not need the signs in any particular order, but the result must match one of the four valid forms.
| You type | Result |
|---|---|
| `$E$1` | Absolute |
| `E$1` | Row locked |
| `$E1` | Column locked |
| `E1` | Relative |
Typed signs behave exactly like the ones F4 inserts. There is no hidden difference.
Ranges: toggle each end
A range such as A2:A100 is two references joined by a colon. Each end has its own signs. When you place the cursor inside the whole range text and press F4, Sheets normally changes both ends together:
A2:A100 -> $A$2:$A$100 -> A$2:A$100 -> $A2:$A100 -> A2:A100This is what you want for a lookup or sum range. It is also possible to lock only one end on purpose. A common case is a running total:
=SUM($B$2:B2)In row 2 this adds B2 alone. Fill down to row 3 and it becomes =SUM($B$2:B3), which adds B2 and B3. The start is locked and the end moves. For this formula you may need to edit one end by hand if F4 changes both.
Choosing the right state
Pressing the key is easy. Choosing the state is the real skill. Ask two questions before you press anything:
- Which direction will I copy? Down changes the row. Across changes the column. Both changes both.
- For each reference, should it follow the copy or stay put?
Then lock only what must stay put.
| Situation | Copy direction | Reference to lock | Result |
|---|---|---|---|
| One tax rate in `E1`, prices in column A | Down | The rate, both parts | `$E$1` |
| Headers in column A, headers in row 1, grid of results | Across and down | Column of the row header, row of the column header | `$A2` and `B$1` |
| Rate stored in a row, copied down a list | Down | Nothing needs the row to change, so lock the row | `E$1` |
| Only one column of data, copied across to other columns | Across | Lock the column | `$A2` |
A mixed reference is correct when only one direction of copying happens, or when two references each need to hold a different part still.
Worked example: toggling in a two-way table
Build the multiplication table from earlier chapters, with row headers in A2:A5 and column headers in B1:E1. In B2, type =A2*B1. You need column A locked for the first reference and row 1 locked for the second.
- Place the cursor inside
A2and press F4 three times:A2to$A$2toA$2to$A2. - Place the cursor inside
B1and press F4 twice:B1to$B$1toB$1. - The formula is now
=$A2*B$1. - Copy
B2across toE2, then fill all four rows down.
Check one cell. In D4 the formula is =$A4*D$1. The column of the first reference stayed at A, and the row of the second stayed at 1, as intended.
Toggling and copying: what actually changes
Toggling changes the formula text in the cell you are editing. It does not change any other cell. The effect appears only when you copy or fill. Two common slips follow from this:
- Toggling after copying. If you fix
B2after you have already filledB3:B100, onlyB2is corrected. The other cells still hold the old formula. Fix the first cell, then copy it down again so every cell is overwritten. - Editing one cell in the middle. If you change
B50only, the column is now inconsistent. The cells above and below still use the old version.
A quick check is to click a cell near the end of the filled range and read its formula. The locked parts should be identical to the first row. Only the moving parts should differ.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| Results are right in row 2 and wrong or zero below it | Rate reference left relative (`E1`), so it drifted to `E2`, `E3` | Change to `$E$1` and fill down again |
| Table has the same value in every cell | Both references fully locked (`$A$2*$B$1`) | Use `$A2` and `B$1` |
| Values repeat across columns but vary down rows | Column locked on both references | Lock only the column of the first and the row of the second |
| `#DIV/0!` or `#VALUE!` after filling | A reference slid onto an empty or text cell | Lock the reference that should not slide |
| F4 changes the wrong reference | Cursor sat in a different reference | Click inside the target reference first |
| F4 pressed once too often | The cycle passed the state you wanted | Keep pressing until it loops back |
When a copied formula gives a strange answer, click one wrong cell, read its formula, and compare it to the first cell. The difference in the dollar signs usually shows the cause.
A habit worth building
Decide the signs while you write the first formula, not after you see a problem. Write the formula in the top-left cell of the area you will fill. Toggle each reference to the state you decided. Fill. Then spot-check the last cell. This sequence takes a few seconds and catches most mistakes.
Exercise
Cell B2 contains =A2*E1. You want to fill B2 down to B50 so that every row multiplies its own column A value by the single rate stored in E1. Which key presses and cursor position change the formula correctly, and what formula do you fill down?
Show answer
Enter edit mode in B2, place the cursor inside E1, and press F4 once. The reference cycles from E1 to $E$1, giving =A2*$E$1. Then fill B2 down to B50 again. The A2 part stays relative and changes to A3, A4, and so on, while $E$1 stays fixed. If F4 does nothing on your device, type the two dollar signs by hand.
Exercise
Starting from the relative reference C5, how many F4 presses give you $C5, and what does each of the intermediate forms lock?
Show answer
Three presses. The first gives $C$5, which locks both column and row. The second gives C$5, which locks only the row. The third gives $C5, which locks only the column.
Exercise
A running total in column C uses =SUM(B2:B2) in C2. You want each row to add everything from B2 down to the current row. What should the formula be, and why can't you get it by pressing F4 on the whole range?
Show answer
Use =SUM($B$2:B2) in C2 and fill down. The start of the range is locked so it always begins at B2, and the end stays relative so it grows to B3, B4, and so on. F4 on the whole range text normally changes both ends together, so you must lock the start only, by typing the $ signs on the first reference or by toggling that end on its own.