Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Locked Formula in Excel: How to Lock Cell References

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To lock a formula in Excel, you make its cell references absolute by adding dollar signs before the column and row (for example, $A$1), then press F4 to toggle the reference type quickly. This keeps the formula pointing at the same cell when you copy it down or across. You can also protect the worksheet to stop anyone editing the formula itself. Below are the exact steps for both jobs, plus the mistakes that trip people up.

What You'll Need

  • Excel for Windows, Mac, or Excel for the web. The F4 shortcut works on Windows; on Mac you may need to press Fn+F4 or use the menu.
  • A worksheet with at least one formula you want to lock.
  • Optional: a password if you plan to protect the sheet. Remember it — Excel cannot recover a forgotten sheet password.

Step-by-Step

  1. Open your workbook and click the cell that contains the formula you want to lock. The formula appears in the formula bar.
  2. Enter edit mode by double-clicking the cell or pressing F2. Your cursor is now inside the formula.
  3. Select the cell reference you want to lock. For example, if the formula is =A1*B1 and you want to always multiply by the value in B1, click on B1 inside the formula.
  4. Press F4 (Windows) or Fn+F4 (many Macs). Excel cycles through four reference types: relative (A1), absolute ($A$1), mixed row ($A1), and mixed column (A$1). Stop when you see the dollar signs you need. For a fully locked reference, you want $B$1.
  5. Repeat for any other references that should stay fixed. You can also type the dollar signs manually if you prefer.
  6. Press Enter to confirm the formula. The cell now contains an absolute reference.
  7. Copy the formula to other cells by dragging the fill handle or using Ctrl+C and Ctrl+V. The locked reference stays the same; unlocked references adjust relative to their new position.
  8. Optional: protect the sheet so the formula cannot be overwritten. Go to the Review tab and click Protect Sheet. In the dialog, you can set a password and choose what users are allowed to do. By default, all cells are locked when protection is on, but this only takes effect after you enable protection. Click OK.

Common Mistakes

  • Locking the wrong part of the reference. A mixed reference like $A1 locks only the column; A$1 locks only the row. If copying down, you usually want the row locked; if copying across, lock the column.
  • Forgetting to protect the sheet. Absolute references stop the formula from changing when copied, but anyone can still edit the formula itself. Sheet protection prevents that.
  • Protecting before unlocking input cells. By default, all cells are locked when you protect a sheet. If you want users to type in certain cells, select those cells, press Ctrl+1, go to the Protection tab, and clear the Locked checkbox before protecting.
  • Assuming F4 works everywhere. On some Mac keyboards, F4 controls volume or brightness. Use Fn+F4 or the Formula Bar's reference toggle. In Excel for the web, F4 may not cycle references; type the dollar signs manually.
  • Locking a reference in a table. Structured references (like Table1[Column1]) do not use dollar signs. They are already fixed to the table column and behave differently when copied.

Tips

  • Use the F4 key repeatedly to cycle through all four reference types quickly — it is faster than typing dollar signs.
  • If you need to lock many references at once, select the whole formula in the formula bar and press F4; Excel may not change all of them, so check each one.
  • Name a cell (Formulas > Define Name) and use the name in your formula. Named ranges are absolute by default and easier to read than $B$1.
  • When sharing a workbook, protect the sheet with a password and tell users which cells they can edit. This prevents accidental formula deletion.
  • To see which cells are locked, go to Home > Find & Select > Go To Special > Formulas. This selects all formula cells so you can inspect or protect them.

Troubleshooting

If your formula still changes when you copy it, check that you actually added dollar signs to the correct part of the reference. Press F2 on the cell and look at the formula bar. If you see A1 without dollar signs, it is still relative. Also confirm you copied the cell rather than moving it — moving a cell does not adjust references the same way.

If Protect Sheet does not stop edits, make sure you clicked OK and that the cells you want to protect are marked as Locked. By default they are, but someone may have cleared the Locked checkbox. Also check whether the workbook is shared or protected in another way; shared workbooks have limited protection options.

If you forgot the sheet password, Excel cannot recover it. You would need to unprotect the sheet using a backup copy or recreate the sheet. Always store passwords safely.

Frequently Asked Questions

What does locking a formula actually do?

It does two things: it makes cell references absolute so they do not shift when copied, and it can prevent editing if you also protect the worksheet. Locking references alone does not stop someone from changing the formula.

How do I lock a formula so it cannot be edited?

First lock the cell (Format Cells > Protection > Locked, which is on by default), then go to Review > Protect Sheet and set a password. Only then is the formula protected from changes.

Can I lock only part of a formula?

Yes. You can mix relative and absolute references in the same formula. For example, =A1*$B$1 locks only B1. Use F4 on each reference individually.

Why does F4 not add dollar signs on my Mac?

Many Mac keyboards map F4 to another function. Try Fn+F4, or type the dollar signs manually. In Excel for the web, F4 may not work at all; type them.

Does protecting a sheet stop users from sorting or filtering?

By default, Protect Sheet disables sorting and filtering. In the Protect Sheet dialog, you can check the boxes for Sort and AutoFilter to allow them while keeping formulas locked.

Can I lock a formula without a password?

Yes. In the Protect Sheet dialog, leave the password field blank. Anyone can then unprotect the sheet via Review > Unprotect Sheet, but it still prevents accidental edits.