To lock a formula in Excel using a shortcut key, highlight the cell reference in the formula bar and press F4 (on some laptops, Fn + F4). This automatically inserts dollar signs ($) to create an absolute reference, preventing the cell address from changing when you copy or drag the formula to other cells.

In Excel, "locking" a cell is technically known as creating an absolute reference. By default, Excel uses relative references, meaning if you copy a formula one row down, the cell references also move one row down. Adding a dollar sign before the column letter (e.g., $A1) or the row number (e.g., A$1) tells Excel to keep that specific part of the reference stationary, regardless of where the formula is moved.

What You'll Need

  • A computer with Microsoft Excel installed (Windows or macOS).
  • A keyboard with a function key row (F1-F12).
  • An existing worksheet with data and at least one formula.

Step-by-Step

  1. Select the Cell: Click on the cell that contains the formula you want to modify, or click into a cell to start typing a new formula.
  2. Enter Formula Edit Mode: Double-click the cell or click inside the Formula Bar at the top of the screen. This allows you to place your cursor specifically on the cell reference you wish to lock.
  3. Highlight the Reference: Use your mouse or keyboard arrows to place the blinking cursor on or immediately next to the cell reference (for example, "B2"). You can also highlight the entire reference (B2) with your mouse.
  4. Press the Shortcut Key: Press the F4 key on your keyboard.
    • Windows: Press F4. If your keyboard has a "Fn" (Function) key, you may need to press Fn + F4.
    • macOS: Press Command + T (Cmd + T) or F4 (depending on your system settings and keyboard layout).
  5. Cycle Through Reference Types: Each time you press F4, Excel cycles through the four available reference types:
    • First Press: Absolute Reference (e.g., $B$2) — Both column and row are locked.
    • Second Press: Mixed Reference (e.g., B$2) — Only the row is locked.
    • Third Press: Mixed Reference (e.g., $B2) — Only the column is locked.
    • Fourth Press: Relative Reference (e.g., B2) — No locks; returns to the original state.
  6. Confirm the Formula: Once the dollar signs are in the desired positions, press Enter or click the checkmark in the formula bar to save the changes.

Common Mistakes

  • Pressing F4 while the cell is only selected: If you simply click a cell once and press F4, Excel may not know which part of the formula to lock. You must be in "Edit Mode" (cursor blinking inside the formula) for the shortcut to work.
  • Ignoring the Fn Key: Many modern laptops map the F-keys to media controls (volume, brightness). If F4 changes your volume instead of locking the cell, you must hold the Fn key while pressing F4.
  • Over-locking: Locking every single cell in a complex formula can make it impossible to drag the formula to other areas of the sheet. Only lock the cells that act as constants (like a tax rate or a specific date).
  • Confusing Row and Column Locks: It is common to accidentally lock the column ($A1) when you intended to lock the row (A$1). Always double-check the position of the dollar sign before dragging the formula.

Tips

  • The "Constant" Rule: As a general rule of thumb, if a value is in a single, static cell (like a "Discount Rate" in cell H1), it should almost always be an absolute reference ($H$1).
  • Mass Editing: If you have already dragged a formula and realized you forgot to lock the cells, you cannot "mass lock" them. You must go back to the first cell, apply the F4 shortcut, and then drag the corrected formula down again.
  • Visual Check: When you drag a formula, look at the cells it is referencing. If the colored border of the reference box moves when it should stay put, you missed a dollar sign.
  • Named Ranges: If you find yourself locking the same cell frequently, consider using a "Named Range." Select the cell, type a name (like "TaxRate") in the Name Box (top left), and use that name in your formulas. Named ranges are absolute by default.

Troubleshooting

The F4 key is not doing anything: First, check if your cursor is actually blinking inside the formula bar. If it is, and F4 still doesn't work, try holding the Fn key. If you are on a Mac and F4 isn't working, try Cmd + T.

The dollar signs are appearing in the wrong place: This usually happens because the cursor was not placed precisely on the cell reference. Click back into the formula, delete the incorrect dollar signs, and ensure the cursor is touching the cell reference before pressing F4 again.

The formula returns an error after locking: Locking a cell doesn't change the math, but it changes which data the formula looks at. If you get a #VALUE! or #REF! error, check if the locked reference is pointing to a cell that contains text instead of a number, or if the cell was deleted.

Frequently Asked Questions

What is the difference between $A$1 and A1?

A1 is a relative reference; if you copy the formula down one row, it becomes A2. $A$1 is an absolute reference; no matter where you copy the formula, it will always point to cell A1.

Can I lock only the row or only the column?

Yes. These are called mixed references. Pressing F4 multiple times allows you to choose A$1 (locks the row) or $A1 (locks the column).

Does the F4 shortcut work in Google Sheets?

Yes, the F4 shortcut works similarly in Google Sheets to toggle between absolute and relative references while editing a formula.

Do I have to type the dollar signs manually?

No, though you can. Typing the $ symbol manually is slower and more prone to typos than using the F4 shortcut.

Why does my formula change when I drag it?

This is Excel's default behavior. It assumes that if you are moving the formula, you also want to move the data source. To stop this, you must use the F4 shortcut to lock the specific cells you want to remain stationary.