Excel course · Lesson 28 of 34

Protecting sheets and workbooks

Lock formulas while leaving input cells editable, protect workbook structure, encrypt a file with a password, and understand what each protection really does.

Advanced 15 min read

You built a careful model, sent it to five colleagues, and one of them typed a number over a formula. Protection prevents that. Excel has several layers of protection, each with a different purpose, and it is important to know which layer stops what, and which ones are only a polite request rather than real security.

The layers at a glance

ProtectionWhereWhat it doesReal security?
Locked cells + Protect SheetReview › Protect › Protect SheetStops editing of locked cells on one sheetNo: prevents accidents, not determined users
Protect Workbook (structure)Review › Protect › Protect WorkbookStops adding, deleting, renaming, moving, hiding or unhiding sheetsNo
Allow Edit RangesReview › Protect › Allow Edit RangesLets certain ranges be edited on a protected sheet, optionally with a password (Windows)No
Encrypt with PasswordFile › Info › Protect Workbook › Encrypt with PasswordThe file cannot be opened without the passwordYes: strong encryption
Password to modifyFile › Save As › Tools › General OptionsOpens read-only unless the password is enteredLimited
Mark as FinalFile › Info › Protect WorkbookShows a banner discouraging editsNo
Sensitivity labels / permissionsHome › Sensitivity (Microsoft 365 business)Rights management controlled by your organisationYes, managed by IT

How locked cells work

Every cell has a Locked property, and by default it is switched on for all cells. It has no effect until the sheet is protected. So the method is always: first unlock the cells users may edit, then protect the sheet.

B5fx=PMT(B3/12, B4*12, -B2)
AB
1Loan calculator
2Loan amount20000
3Annual rate0.06
4Years5
5Monthly payment386.66

Inputs in B2:B4 should be editable; the formula in B5 must be protected.

Result: 386.66

  1. Select the input cells B2:B4.
  2. Press Ctrl+1 (Mac: Cmd+1), open the Protection tab, untick Locked, and click OK. Give them a light fill colour so users see where to type.
  3. Optionally select B5, open the Protection tab again and tick Hidden. On a protected sheet, the formula then does not show in the formula bar.
  4. Choose Review › Protect › Protect Sheet.
  5. Leave Select locked cells and Select unlocked cells ticked. Tick any extra permissions users need, such as Format columns or Use AutoFilter (and Sort, though sorting still fails if the range includes locked cells).
  6. Type a password if you want one (optional, and remember it), click OK, and confirm the password.
  7. Test: typing in B5 shows a message that the cell is protected; typing in B3 works.
Tip. Untick Select locked cells in the Protect Sheet dialog for input forms. Users can then only click the unlocked cells, and the Tab key jumps from one input cell to the next.

To remove protection, choose Review › Protect › Unprotect Sheet and enter the password if one was set.

Watch out. Sheet protection passwords are not encryption. They are easy to remove with freely available tools, and anyone can copy the visible data to a new workbook. Use sheet protection to stop accidents. For confidential data, use Encrypt with Password or your organisation's sensitivity labels.

Protecting tables, filters and PivotTables

  • An Excel table on a protected sheet cannot grow automatically. Users can type into unlocked cells inside it, but new rows are not added. Either unprotect for data entry or use a form.
  • AutoFilter works on a protected sheet only if filters were turned on before protecting and Use AutoFilter was ticked.
  • PivotTables cannot be refreshed on a protected sheet unless Use PivotTable & PivotChart is ticked, and even then refreshing may fail if it changes the layout. A small VBA macro can unprotect, refresh and re-protect (What is VBA? Macros, when to use them and macro security).

Allow Edit Ranges

On Windows, Review › Protect › Allow Edit Ranges lets you define ranges that particular people may edit on a protected sheet, each optionally with its own password. For example, the North manager can edit the North block with one password, the South manager the South block with another. Set the ranges first, then protect the sheet.

Protecting the workbook structure

  1. Choose Review › Protect › Protect Workbook.
  2. Keep Structure ticked and enter an optional password.
  3. Click OK. Users can no longer insert, delete, rename, move, copy, hide or unhide sheets.

This is how you keep a hidden calculation sheet hidden: hide it (right-click tab › Hide), then protect the structure, so Unhide is greyed out. For stronger hiding, VBA can set a sheet to very hidden, which does not appear in the Unhide list at all.

Encrypting the file

  1. Choose File › Info › Protect Workbook › Encrypt with Password (Mac: Review › Protect Workbook, or File › Passwords).
  2. Type a strong password and confirm it.
  3. Save the file. From now on Excel asks for the password before opening it.
Watch out. If you lose an encryption password, Microsoft cannot recover the file. Store the password in a password manager. Do not send the password in the same email as the file.

Other options

  • Password to modify (File › Save As › Tools › General Options on Windows): others can open read-only without the password. Useful as a speed bump, not as security.
  • Always Open Read-Only (File › Info › Protect Workbook): asks users to open read-only by default.
  • Mark as Final: a banner suggests the file is finished. Anyone can click Edit Anyway.
  • Inspect Document (File › Info › Check for Issues): finds hidden sheets, comments, personal information and hidden names before you share a file externally.
  • In shared OneDrive or SharePoint files, controlling who can edit through the Share dialog is often the cleanest protection of all (Collaboration: co-authoring, comments, notes and version history).
Note. Sheet protection and workbook structure protection work in Excel for Windows, Mac and the web (on the web via Review › Protect Sheet and Protect Workbook in current versions). Allow Edit Ranges with passwords is Windows-only. Files encrypted with a password can be opened in Excel for the web, but some co-authoring features are not available for them.

Check yourself

1. All cells are locked by default. Why can you still type in them?

2. What is the correct order to protect a form?

3. Which option actually prevents someone without the password from opening the file?

4. You want to stop users unhiding a hidden sheet. What do you protect?

5. What does ticking Hidden on the Protection tab do once the sheet is protected?

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 12 KB