Excel 2024: Use F4 for Absolute Reference or Repeating Commands
June 12, 2024 - by Bill Jelen
The mighty F4 key should be in your Excel arsenal for two completely different reasons:
- Use F4 to add dollar signs in formula references to make them absolute, mixed, or relative.
- When you are not editing a formula, use F4 to repeat the last command.
Illustration: Cartoon Bob D'Amico
Make a Reference Absolute
In the following figure, the tax in C2
is B2
times F1
.
But when you copy this formula down, none of the sales tax calculations are working. As you copy the formula down the column, the B2
reference automatically changes to B3
, B4
, and so on. That is what you want. But unfortunately, the reference to the sales tax in F1
is changing as well. That is not what you want.
The solution? Edit the original formula and press F4. Two dollar signs are added to the final element of the formula. The $F$1
says that no matter where you copy this formula, that part of the formula always needs to point to F1
. This is called an absolute reference. Pressing F4 while the insertion point is touching the F1
reference is a fast way to add both dollar signs.
There are other times when you need only part of the reference to be locked. In the following example, you need to multiply H2
by A3
by C1
. The H1
will always point to H1
, so you need both dollar signs in $H$1
. The A3
will always point back to column A, so you need $A3
. The C1
will always point to row 1, so you need C$1
.
To enter the above formula, you would press F4 once after clicking on H1
, three times after clicking on A3
, and twice after clicking on C1
. What if you screw up and press F4 too many times? Keep pressing F4: It will toggle back to relative then absolute, then row absolute, then column absolute.
The result? A single formula that can be copied to C3:F12
.
Tip
If you forget to put dollar signs in the formula, you can edit the formula, click inside any cell reference and press F4 the appropriate number of times. If you have a cell reference such as C3:C12
, select the colon with the mouse and press F4 to change both C3
and C12
to $C$3:$C$12
.
Caution: There is a special type of reference called an Expanding Range. In this instance, you might lock down the start of the range using F$3
but let the end of the range be relative. The reference starts out as F$3:F3
but will expand as you copy it down, such as F$3:F12
. Using F4 will never toggle through an expandable reference. You have to click inside the first F3
in the formula bar and press F4 to change just that part of the reference. See an Expanding Range in use in "#64 Preview What Remove Duplicates Will Remove" on page 164.
Repeat the Last Command
Keyboard shortcuts are great. For example, Alt+E, D, C Enter deletes a column. But even if you are really fast at doing Alt+E, D, C Enter, it can be a pain to do this many times in a row.
After deleting column B, press the Right Arrow key to move to the next column that needs to be deleted. Instead of doing Alt+E, D, C Enter again, simply press F4. This beautiful command repeats the last command that you invoked.
To delete the remaining columns, keep pressing Right Arrow and then F4.
Next, you need to delete a row, so use Alt+E, D, R Enter to delete the row.
To keep deleting rows, press the Down Arrow key followed by F4 until all the blank rows are gone.
The F4 trick works for a surprising number of commands. Perhaps you just built a custom format to display numbers in thousands: #,##0,K
. If you see a few more cells that need the same format, select the cells and press F4.
Annoyingly, a few commands do not work with F4. For example, going into Field Settings in a pivot table and changing the number format and calculation is one that would be nice to repeat. But it does not work.
Bonus Tip: Use a Named Range Instead of Absolute References
If you want to avoid using $ in references to make them absolute, you can use named ranges instead. Select the tax rate cell in F1 and click in the name box to the left of the formula bar.
Type a name for this cell or range of cells. You cannot use spaces in the name, but TaxRate (or Tax_Rate) will work.
When you type the formula, use =B2*TaxRate
.
Tip
To see all of the named ranges in a worksheet, reduce the zoom to 39% or lower.
Thanks to Myles Arnott, Glen Feechan, Shelley Fishel, Colin Legg, and Nathan Zelany for suggesting this feature. Bob Umlas sent in the tip about seeing names below 39% zoom.
This article is an excerpt from MrExcel 2024 Igniting Excel