When Excel shows an error like #REF! or #VALUE! in a cell that contains a formula, and the cell is not protected, the cause is almost always a broken reference, a data type mismatch, or a formula that points to a deleted or moved cell. The quickest fix is to check the formula for invalid references, correct the arguments, and then lock the cell if you want to prevent accidental edits. This guide walks through diagnosing the error, repairing the formula, and applying protection correctly so the error does not return.

What You'll Need

  • Excel for Windows or Mac (steps may vary slightly by version and region; menu labels can differ).
  • The workbook containing the formula that shows the error.
  • Edit permission on the sheet (if the sheet is already protected, you will need the password to unprotect it).

Step-by-Step

  1. Identify the error type. Click the cell with the error. Look at the formula bar. Common errors include #REF! (a reference points to a deleted cell), #VALUE! (wrong data type, such as text where a number is expected), #DIV/0! (division by zero), and #NAME? (unrecognized function name or missing quotes). The error code tells you what to fix.
  2. Check for broken references. If you see #REF!, the formula refers to a cell or range that no longer exists. Edit the formula and replace the #REF! token with a valid range. For example, if you deleted column B and the formula was =A1+B1, it becomes =A1+#REF!. Change it to =A1+C1 or whatever column now holds the intended data.
  3. Verify data types. For #VALUE!, ensure all arguments are the correct type. Text in a cell that should be a number will cause this. Use ISTEXT or ISNUMBER to test, or convert text numbers with VALUE() or by using Text to Columns. Also check for hidden spaces or non-printing characters that make a number look like text.
  4. Trace precedents and dependents. On the Formulas tab, use Trace Precedents to see which cells feed the formula. This helps spot a cell that was accidentally cleared or contains an error itself. If a precedent cell shows an error, fix that cell first; the error propagates.
  5. Evaluate the formula step by step. Use Formulas > Evaluate Formula to walk through calculation. This shows which part of the formula produces the error, so you can correct the exact argument rather than guessing.
  6. Correct the formula. Once you know the problem, edit the formula in the formula bar. Press Enter to confirm. If the error clears, the formula is now valid. If it persists, repeat steps 2–5.
  7. Decide on protection. If the cell should not be edited by others, protect the sheet. First, unlock any cells that users must edit: select them, press Ctrl+1 (Cmd+1 on Mac), go to the Protection tab, and clear Locked. Then go to Review > Protect Sheet, set a password if desired, and choose what users can do. Note that protecting a sheet does not fix formula errors; it only prevents changes. Fix the error before protecting.
  8. Test the protected sheet. Try editing a locked cell; Excel should block it. Try editing an unlocked cell; it should work. If the formula still shows an error after protection, unprotect the sheet (Review > Unprotect Sheet), fix the formula, and re-protect.

Common Mistakes

  • Protecting the sheet before fixing the error, which locks in the broken formula and makes it harder to correct later.
  • Assuming #REF! can be fixed by undo; if the workbook was saved and closed, undo is not available, so manual correction is needed.
  • Forgetting that protecting a sheet does not prevent errors from external links or volatile functions; those can still produce errors even when cells are locked.
  • Using whole-column references (e.g., A:A) in formulas that include text headers, which can cause #VALUE! when the function expects numbers.
  • Overlooking that some errors are intentional, such as #N/A from VLOOKUP when no match is found; these are not broken formulas but expected results.

Tips

  • Use IFERROR to wrap formulas and display a friendly message instead of an error code, e.g., =IFERROR(A1/B1, "Check input"). This does not fix the underlying issue but improves readability.
  • Before deleting rows or columns, check for formulas that reference them; Excel will update references automatically if you delete entire rows/columns, but not if you delete cells and shift others.
  • Keep a backup copy of the workbook before making structural changes, so you can revert if a formula breaks.
  • When sharing a workbook, protect the sheet and also consider marking the file as final (File > Info > Protect Workbook > Mark as Final) to discourage edits, though this is not a security feature.
  • Regularly use Formulas > Show Formulas (Ctrl+`) to review all formulas at once and spot inconsistencies.

Troubleshooting

If the error persists after following the steps, try these checks:

  • The formula references another sheet that was renamed or moved. Excel usually updates references, but if the sheet was deleted, you will get #REF!. Recreate the sheet or update the formula to point to the correct sheet.
  • The workbook is shared or co-authored. In shared workbooks, some features are limited. If protection options are grayed out, the workbook may be shared; unshare it (Review > Share Workbook) before protecting.
  • The error is in a cell that appears unprotected but is actually locked. Check the cell's protection status via Ctrl+1 > Protection tab. If Locked is checked but the sheet is not protected, the cell is still editable; protection only takes effect when the sheet is protected.
  • Circular reference warning. If Excel shows a circular reference warning, the formula refers to its own cell, directly or indirectly. Use Formulas > Error Checking > Circular References to locate and fix it.
  • External links are broken. If the formula points to another workbook that is closed or moved, you may see #REF! or a prompt to update links. Use Data > Edit Links to manage or break links.

Frequently Asked Questions

Why does my formula show #REF! after I delete a column?

Deleting a column that a formula references removes those cells, so the formula cannot find them. Excel replaces the reference with #REF!. You must edit the formula to point to the correct column or range.

Can I protect a sheet without a password?

Yes. In the Protect Sheet dialog, leave the password field blank. The sheet will be protected, but anyone can unprotect it via Review > Unprotect Sheet without a password. For stronger protection, use a password.

Does protecting a sheet prevent formula errors?

No. Protection prevents users from editing locked cells, but it does not validate formulas. Errors can still occur if the formula is incorrect or if referenced data changes. Always fix errors before protecting.

How do I unlock specific cells for editing while keeping the rest protected?

Select the cells, press Ctrl+1 (Cmd+1 on Mac), go to the Protection tab, and uncheck Locked. Then protect the sheet. Only those cells will be editable.

What if I forgot the password to unprotect a sheet?

Excel does not provide a built-in password recovery. You may need to use a third-party tool or restore from a backup. Prevention: keep passwords in a safe place.

Why does a formula work in one cell but show an error when copied?

Relative references change when copied. If the formula relies on a specific cell, use absolute references (e.g., $A$1) to lock the reference before copying.