How To Lock and Protect Cells With Formulas in Excel Spreadsheets

Protecting cells that contain formulas in Excel is important if you want to avoid accidental changes to the formulas. When cells are locked, others cannot edit, move, or delete data or formulas, helping preserve the integrity of your spreadsheet. There are a few easy ways to lock cells with formulas in Excel.

Why Lock Cells With Formulas

Here are some key reasons you may want to lock cells that contain formulas:

  • Prevent accidental changes – Locking cells prevents others from accidentally deleting or changing formulas. This helps avoid errors and broken references in your spreadsheets.
  • Hide complexity or sensitive data – By locking cells with formulas, you can let others interact with a spreadsheet without exposing the underlying formulas and logic. This is useful if you want to hide complexity or sensitive data like sales targets and projections.
  • Preserve integrity of the spreadsheet – Locking down formula cells ensures no one intentionally or unintentionally tampers with the core logic and calculations in your spreadsheets. This helps maintain data integrity.

Lock All Cells With Formulas

To lock all cells that contain formulas at once:

  1. Select the entire worksheet by clicking the blank square above the row headers and to the left of the column headers
  2. On the Home tab, click the Protection button and select Lock Cells
  3. All cells not already locked will now be locked
  4. You can then password protect the sheet to prevent editing

This will lock all unlocked cells at once, saving you the hassle of locking cells individually. Do be aware this will also lock any empty or data cells that are unlocked, so you may wish to unlock those again after.

Lock Individual Cells

To lock individual cells:

  1. Select the cell(s) with formulas you want to lock
  2. Right click and select Format Cells
  3. On the Protection tab, uncheck the Locked box
  4. Click OK
  5. Password protect the sheet to prevent editing

This gives you more granular control to only lock certain formula cells. You can combine this with locking all cells to get a mix of locked and unlocked cells.

Password Protect Your Spreadsheet

To prevent editing on sheets with locked cells:

  1. Review which sheets have locked cells that need protection
  2. On the Review tab select Protect Sheet
  3. Enter a password and confirm
  4. Click OK

This will password protect the sheet so no changes can be made unless the password is entered. Share the password carefully with only those that may need to edit the sheet.

Tips for Locking Formula Cells

Follow these tips when locking formula cells:

  • Double check cells are locked by trying to edit them before protecting the sheet
  • Make the password strong and communicate it securely to those that need to edit
  • Revert or make a copy with locked cells to prevent accidental overwriting of the original
  • Consider locking only sections that need protection rather than entire sheets
  • Format locked cells differently (font color, etc) to easily identify them

Lock Cells But Allow Sorting or Filtering

You can allow certain actions like sorting and filtering while keeping cells locked. Here is how:

  1. On the Review tab select Allow Users to Edit Ranges
  2. Select the ranges you want to allow sorting/filtering on
  3. Check the boxes for Sort and Use AutoFilter
  4. Click OK
  5. Now protect the sheet with a password while still allowing sorting of unlocked cells

This gives you flexibility to for example allow sorting of an unlocked data range while keeping the formula cells locked.

Unlocking Individual Cells

To unlock individual locked cells:

  1. Select the locked cells
  2. Right click and choose Format Cells
  3. On the Protection tab, check the Locked box
  4. Click OK

Now the selected cells will be unlocked and editable. Useful if you need to edit a locked formula cell.