Sub topic 5
Switching reference types quickly with F4
This chapter assumes you can enter and edit a basic formula, select cells and ranges, and use the fill handle. It also assumes you know what $ does in a reference, which earlier chapters covered. Here you will learn the F4 shortcut, which adds and removes those dollar signs for you.
Why use a shortcut
Typing $ by hand works, but it is slow and easy to get wrong. A missing $ produces wrong results without any error message. The F4 key writes the dollar signs for you and cycles through all four reference types.
The four-step cycle
While you edit a formula, put the cursor inside or right after a reference and press F4. Each press moves to the next form. Starting from a relative reference in B2, the cycle is:
| Presses | Result | Type | What is locked |
|---|---|---|---|
| 0 | `B2` | Relative | Nothing |
| 1 | `$B$2` | Absolute | Column and row |
| 2 | `B$2` | Mixed | Row only |
| 3 | `$B2` | Mixed | Column only |
| 4 | `B2` | Relative | Back to the start |
Worked example: a tax rate in E1
Suppose column B holds prices, and the tax rate is in E1. You want each row in column D to multiply its price by that one rate.
- Select D2 and type
=B2*. - Click cell E1, or type
E1. The formula now reads=B2*E1. - Press F4 once. The formula becomes
=B2*$E$1. - Press Enter.
- Fill the formula down the column.
The result in D2 is:
=B2*$E$1B2 stays relative, so it moves to B3, B4, and so on. $E$1 stays fixed, so every row uses the same rate.
Building a mixed reference
For the multiplication table, you need =$A2*B$1. You can build it with the same key.
- In B2, type
=and click A2. Press F4 three times to reach$A2. - Type
*and click B1. Press F4 twice to reachB$1. - Press Enter, then fill right and down.
The count matters. If you press once too often, you get the wrong lock. Check the formula bar before you press Enter.
B2: =$A2*B$1Changing an existing reference
You can also fix a reference in a formula you already wrote.
- Double-click the cell, or press F2, to enter edit mode.
- Place the cursor on the reference, or select it.
- Press F4 until the form you want appears.
The cursor can sit anywhere in the reference, at the start, middle, or end. If you select a whole range such as B2:B10, F4 changes both ends together. Pressing F4 once turns it into $B$2:$B$10, which is the form used for a fixed total.
C2: =B2/SUM($B$2:$B$10)If you want a running total, you need to anchor only the start of the range. Select just B2 inside the range and press F4 once, giving $B$2:B2. Do not select the whole range.
When F4 does not work
F4 only acts on a reference while you are editing a formula. If you press it on a selected cell that is not in edit mode, Excel repeats your last action instead. This can change formatting or insert rows, so look at the sheet if something unexpected happens. Undo with Ctrl+Z.
Keyboard differences are the other common cause of trouble:
- On many laptops, the function keys act as media or brightness keys. Hold the Fn key and press F4, or change the function key setting in your system.
- On Excel for Mac, Cmd+T is a reliable alternative. F4 also works if the function keys are set to standard mode.
- In Excel for the web, F4 may be captured by the browser. Try Fn+F4, or type the
$signs by hand. - If the cursor is on something that is not a reference, such as a function name or a number, F4 does nothing.
Common errors with F4
- Pressing F4 outside edit mode. Excel repeats the previous command and does not toggle anything.
- Stopping at the wrong step. The two mixed forms look alike. Read the formula bar to see which part carries the
$. - Toggling after you have filled. Changing one cell does not update the cells you already filled. Fix the first formula, then fill again.
- Selecting too much. Selecting a full range changes both ends. Select only one cell address when you want an expanding range.
Exercise
In C2 you have typed =SUM(B2:B2) and want a running total that grows as you fill down. Which part of the range do you select, how many times do you press F4, and what is the final formula in C2?
Show answer
Select only the first B2 inside the range, then press F4 once. The formula becomes =SUM($B$2:B2). Pressing F4 on the whole range would lock both ends and give the same total in every row.
Exercise
You are editing =A2*B1. The column of A must stay fixed and the row of B1 must stay fixed. How many F4 presses does each reference need, starting from relative?
Show answer
A2 needs three presses to become $A2. B1 needs two presses to become B$1. The final formula is =$A2*B$1.