Excel 2024: Use F4 for Absolute Reference or Repeating Commands


June 12, 2024 - by

Excel 2024: Use F4 for Absolute Reference or Repeating Commands

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.

A cartoon shows an F4 Key with arms and legs. In the first panel, F4 is throwing dollar signs into cell references. In the second panel, it shows that F4 is the Repeat Last Action key when you are not in Edit mode.
A cartoon shows an F4 Key with arms and legs. In the first panel, F4 is throwing dollar signs into cell references. In the second panel, it shows that F4 is the Repeat Last Action key when you are not in Edit mode.

Illustration: Cartoon Bob D'Amico


Make a Reference Absolute

In the following figure, the tax in C2 is B2 times F1.

Sales amounts are in B2:B11. A single tax rate is in F1. A new formula of =B2*F1 is being entered.
Sales amounts are in B2:B11. A single tax rate is in F1. A new formula of =B2*F1 is being entered.

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 =B2*F1 formula works in cell C2, but it fails when copied down. The formula in C5 is shown and is =B5*F4. You need the reference to F1 to keep pointing to F1, even if the formula is copied down.
The =B2*F1 formula works in cell C2, but it fails when copied down. The formula in C5 is shown and is =B5*F4. You need the reference to F1 to keep pointing to F1, even if the formula is copied down.

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.

As you are entering the first formula, type =B2*F1 and then press the F4 key. Excel will change the formula to =B2*$F$1.
As you are entering the first formula, type =B2*F1 and then press the F4 key. Excel will change the formula to =B2*$F$1.


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.

A formula shows three types of references =$H$2*$A3*C$1. To create $H$2, touch H2 and then press F4 once. To lock down only the column in $A3, touch A3 and then press F4 three times. To lock down only the row in C$1, touch C1 and press F4 twice.
A formula shows three types of references =$H$2*$A3*C$1. To create $H$2, touch H2 and then press F4 once. To lock down only the column in $A3, touch A3 and then press F4 three times. To lock down only the row in C$1, touch C1 and press F4 twice.

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.

The formula =$H$2*$A3*C$1 works in C3:F12
The formula =$H$2*$A3*C$1 works in 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.

This data set has the annoying feature of a tiny 1-width column between each column of data. Select the first blank column (B1) and Alt+E D C to delete the column.
This data set has the annoying feature of a tiny 1-width column between each column of data. Select the first blank column (B1) and Alt+E D C to delete the column.

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.

Press the right arrow to move to the next blank column. Press F4 to repeat the Delete Column command.
Press the right arrow to move to the next blank column. Press F4 to repeat the Delete Column command.

To delete the remaining columns, keep pressing Right Arrow and then F4.

Keep deleting columns with Right-Arrow, F4, Right-Arrow, F4.
Keep deleting columns with Right-Arrow, F4, Right-Arrow, F4.

Next, you need to delete a row, so use Alt+E, D, R Enter to delete the row.

There are also blank rows between each row of data. Alt+E D R from the first blank row deletes it.
There are also blank rows between each row of data. Alt+E D R from the first blank row deletes it.

To keep deleting rows, press the Down Arrow key followed by F4 until all the blank rows are gone.

From there, press Down Arrow, F4, Down Arrow, F4, and so on.
From there, press Down Arrow, F4, Down Arrow, F4, and so on.

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.

A tax rate of 6.25% is shown in cell F1. If you select F1, the cell address of F1 appears in a Name Box to the left of the formula bar. Click in the Name Box.
A tax rate of 6.25% is shown in cell F1. If you select F1, the cell address of F1 appears in a Name Box to the left of the formula bar. Click in the Name Box.

Type a name for this cell or range of cells. You cannot use spaces in the name, but TaxRate (or Tax_Rate) will work.

Type a name for the cell. The name can not have spaces, so use TaxRate instead of "Tax Rate".
Type a name for the cell. The name can not have spaces, so use TaxRate instead of "Tax Rate".

When you type the formula, use =B2*TaxRate.

After naming the range, any new formulas will use the named range. For example, =B2*TaxRate. In this case, TaxRate is like an absolute reference. As you copy the formula, it will keep pointing at the TaxRate in F1.
After naming the range, any new formulas will use the named range. For example, =B2*TaxRate. In this case, TaxRate is like an absolute reference. As you copy the formula, it will keep pointing at the TaxRate in F1.

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

Title photo by Sofya on Unsplash