Sub topic 5
Switching reference types quickly with F4
You already know that a dollar sign locks part of a cell reference. This chapter covers the faster way to add those dollar signs. Pressing F4 while you edit a formula cycles a reference through its four forms, so you rarely need to type $ by hand.
This chapter assumes you can enter and edit a basic formula, select cells and ranges, and fill a formula down with the fill handle. It also assumes you have met the three reference types: relative (B2), absolute ($B$2) and mixed ($B2 or B$2).
What F4 does
F4 is a toggle key for references. While you are editing a formula, it rewrites the reference under your cursor to the next form in a fixed cycle. It changes only the dollar signs. It never changes which cell or column the reference points to.
The cycle has four steps and then returns to the start:
| Presses | Result for `B2` | Reference type | What stays fixed |
|---|---|---|---|
| 0 | `B2` | Relative | Nothing |
| 1 | `$B$2` | Absolute | Column and row |
| 2 | `B$2` | Mixed, row locked | Row only |
| 3 | `$B2` | Mixed, column locked | Column only |
| 4 | `B2` | Relative again | Nothing |
The order is easy to forget. The first press locks everything. The second locks the row, and the third locks the column. The fourth press removes all locks. If you overshoot, keep pressing until the form you want comes around again.
Where F4 works and where it does not
F4 only toggles references when Excel is in a mode where the formula text is being edited. It does nothing useful in other situations.
- Edit mode. You are typing in a cell, or you pressed F2 on a cell that contains a formula. You can also edit in the formula bar.
- Point mode. You are building a formula and have just clicked a cell or dragged a range to insert its address. The inserted reference is still "live," and F4 changes it.
- Ready mode. The cell is selected but you are not editing it. F4 here does not toggle anything. In most versions of Excel on Windows it repeats your last action, which is the same as Ctrl+Y. This can surprise you. If you press F4 on a selected formula cell, you may reapply a previous formatting or paste step instead of changing the formula.
If nothing happens to the reference, check that the cell is in edit mode. The status bar at the bottom left of the window shows "Edit" or "Point" when you are in one of those modes.
Which reference is affected
In edit mode, F4 works on the reference that the cursor is touching. "Touching" means the cursor is inside the reference text or directly beside it. In =B2*E1, if the cursor sits right after E1, F4 changes E1 and leaves B2 alone.
If you select a block of formula text first, F4 applies to the references inside the selection. This is quick but easy to get wrong. References that start in different forms are each moved to their own next step, so you can end up with a mix you did not intend. For predictable results, change one reference at a time.
Keyboard differences
| Platform | Typical key |
|---|---|
| Windows, full keyboard | F4 |
| Windows laptop with function keys in media mode | Fn+F4 |
| Mac, Excel | Cmd+T. Recent versions also accept F4 or Fn+F4, depending on your keyboard settings. |
| Excel for the web | F4 usually works in edit mode, but a browser or the operating system can intercept it. If it does not respond, type the `$` characters directly. |
On many laptops the F4 key also controls volume, brightness or similar. Those keys need Fn held down unless you changed the keyboard setting. If F4 does nothing in edit mode on a laptop, try Fn+F4 first.
Worked example 1: lock a tax rate
Column B holds prices and cell E1 holds a tax rate. You want D2 to compute the tax for row 2, and then to fill that formula down.
- Select D2 and type
=. - Click B2. Excel inserts
B2into the formula. - Type
*, then click E1. The formula is now=B2*E1, and E1 is still in point mode. - Press F4 once. The formula becomes
=B2*$E$1. - Press Enter.
- Select D2 again and drag the fill handle down.
The result in D2 and the row below it:
D2: =B2*$E$1
D3: =B3*$E$1You pressed F4 once because the tax rate needs both its column and its row locked. B2 stays relative so each row reads its own price. This matches the pattern from earlier chapters: relative for the value that changes by row, absolute for the fixed input.
The order of operations matters. Press F4 right after clicking E1, while the cursor is still beside the new reference. If you type more characters or click elsewhere first, the cursor moves, and F4 changes a different reference or none.
Worked example 2: a multiplication table in two keystroke bursts
A multiplication table needs mixed references. Put the row labels in A2:A10 and the column labels in B1:J1. In B2 you want this formula, which you then fill right and down:
B2: =$A2*B$1Build it with F4 like this:
- In B2, type
=and click A2. The formula reads=A2. - Press F4 three times:
$A$2, thenA$2, then$A2. Stop on$A2, which locks the column and lets the row move. - Type
*and click B1. The formula reads=$A2*B1. - Press F4 twice:
$B$1, thenB$1. Stop onB$1, which locks the row and lets the column move. - Press Enter, then fill the formula across to J2 and down to row 10.
Counting presses is the common source of mistakes here. A quick check is to look at the result as you press. Where the dollar sign sits shows what is locked. A $ before the letter locks the column. A $ before the number locks the row.
Worked example 3: a running total with a range
An expanding range such as =SUM($B$2:B2) locks only the start of the range. F4 treats a range as one unit when the cursor is anywhere inside it. If you build =SUM(B2:B2) first and then press F4, you lock both ends and get $B$2:$B$2. That is not what you want.
Build the formula in order instead, so F4 acts on only the first cell:
- In C2, type
=SUM(. - Click B2, then press F4 once. The formula reads
=SUM($B$2. - Type
:and click B2 again. The newB2is relative, because it was inserted after the first one was set. - Type
)and press Enter.
The result in C2 and C3 after filling down:
C2: =SUM($B$2:B2)
C3: =SUM($B$2:B3)The start of the range is fixed at B2, and the end moves down one row with each fill. This approach avoids the problem of toggling a whole range at once.
If you do need to lock a full range, such as the denominator in a share-of-total formula, the whole-range behavior is what you want:
C2: =B2/SUM($B$2:$B$10)Here, type =B2/SUM(, drag across B2:B10, and press F4 once. Excel changes both ends of the range together, giving $B$2:$B$10. Further presses cycle the whole range through B$2:B$10, then $B2:$B10, then back to B2:B10.
Other kinds of references
F4 handles several reference shapes. Some behave a little differently from a single cell.
References to other sheets
A sheet name in front of a reference does not stop F4 from working. With the cursor beside Rates!B1, one press gives Rates!$B$1, and the cycle continues as before:
C2: =B2*Rates!$B$1F4 changes only the cell part. The sheet name is not affected.
Whole columns and rows
References such as A:A or 1:1 have fewer forms, because only one dimension exists. In current versions of Excel, F4 on A:A gives $A:$A, and the next press returns it to A:A. A reference like 1:1 behaves the same way with the row number.
Defined names
A defined name such as TaxRate has no dollar signs, and F4 does nothing to it. That is by design. A name refers to the same cell wherever you copy the formula. If you rename a cell and use the name in the formula, you do not need F4 at all:
D2: =B2*TaxRateThe next chapters in this series cover names in detail. For now, remember that F4 is a tool for cell and range references only.
Structured table references
If your data is in an Excel table and you use column names such as Table1[Price], F4 also has no effect. Those references are managed by the table and do not use dollar signs.
Common problems with F4
| Symptom | Likely cause | Fix |
|---|---|---|
| Nothing changes in the formula | The cell is not in edit mode, or a laptop needs Fn | Press F2 first, then try F4 or Fn+F4 |
| The wrong reference toggles | The cursor was beside a different reference | Click inside the right reference, or use the arrow keys to move the cursor onto it, then press F4 |
| A whole range locked when you wanted one end | The cursor was inside the range token | Build the range in order: set the first cell, then type `:` and add the second |
| A previous action repeats instead | The cell was selected but not in edit mode | Undo with Ctrl+Z and press F2 before F4 |
| Pressed one too many times | The cycle moved past the form you wanted | Keep pressing until the form returns, or type the `$` by hand |
| F4 does not affect a name | Names have no dollar signs | Edit the name's definition in Name Manager if you need a different target |
Moving the cursor onto an existing reference
You often return to a formula that already exists and need to fix one reference. A reliable sequence is:
- Select the cell and press F2 to enter edit mode.
- Use the arrow keys, or click in the formula bar, to place the cursor inside the reference you want to change.
- Press F4 until the form is right.
- Press Enter to confirm, or Esc to discard the changes.
After you confirm, fill or copy the formula again. Cells that were filled earlier do not update when you change the original. You must copy the corrected formula over them.
Checking your result
A quick way to verify what F4 did is to look at the formula after filling. Select the last cell in the filled range and press F2. The references show colored borders on the sheet. Check that every locked reference still points to the same cell as in the first row, and that every relative one has shifted by the expected number of rows or columns.
Another check is to press Ctrl+` (the grave accent key), which shows formulas instead of values on the whole sheet. Press it again to return to normal view. Compare the first and last rows. If a locked reference differs between them, you pressed F4 the wrong number of times.
Summary of the habits
- Press F4 immediately after you insert or click a reference, while the cursor is still beside it.
- Learn the cycle: plain, both locked, row locked, column locked, plain.
- Read the dollar signs by their position, not by counting presses.
- Build expanding ranges in order so F4 acts on only the first cell.
- If F4 does nothing, check edit mode first, then Fn.
- Always test the filled result in a far corner of the range.
Exercise
A cell contains =B5*E1 and you are in edit mode with the cursor just after E1. You press F4 three times. What does the formula read now, and which part of E1 can move when you fill the formula?
Show answer
After one press the formula is =B5$E$1, after two it is =B5E$1, and after three it is =B5*$E1. The column is locked and the row can move. When you fill down, E1 becomes E2, E3 and so on. When you fill right, it stays in column E.
Exercise
You want D2 to hold a formula that you can fill down and across, where the column letter comes from row 1 and the row number comes from column A. You have typed =A2*B1 and have the cursor next to each reference in turn. Write the final formula and say how many F4 presses each reference needed.
Show answer
The final formula is =$A2*B$1. A2 needed three presses (first $A$2, then A$2, then $A2). B1 needed two presses (first $B$1, then B$1).
Exercise
You build a running total by typing =SUM(B2:B2) and then pressing F4 with the cursor inside the range. What do you get, and what is a safer way to build it so only the start is locked?
Show answer
F4 treats the range as one unit, so you get =SUM($B$2:$B$2), which locks both ends and does not expand. A safer way is to type =SUM(, click B2, press F4 once to get $B$2, then type : and click B2 again for a relative second end. The result is =SUM($B$2:B2), which expands by one row each time you fill down.
Exercise
You select a formula cell without entering edit mode and press F4. The formula does not change, but some formatting does. Why, and how do you correct it?
Show answer
In ready mode F4 repeats your last action instead of toggling references, so it reapplied a previous step such as formatting. Undo with Ctrl+Z, press F2 to enter edit mode, place the cursor on the reference, and then press F4.