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.
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
| Protection | Where | What it does | Real security? |
|---|---|---|---|
| Locked cells + Protect Sheet | Review › Protect › Protect Sheet | Stops editing of locked cells on one sheet | No: prevents accidents, not determined users |
| Protect Workbook (structure) | Review › Protect › Protect Workbook | Stops adding, deleting, renaming, moving, hiding or unhiding sheets | No |
| Allow Edit Ranges | Review › Protect › Allow Edit Ranges | Lets certain ranges be edited on a protected sheet, optionally with a password (Windows) | No |
| Encrypt with Password | File › Info › Protect Workbook › Encrypt with Password | The file cannot be opened without the password | Yes: strong encryption |
| Password to modify | File › Save As › Tools › General Options | Opens read-only unless the password is entered | Limited |
| Mark as Final | File › Info › Protect Workbook | Shows a banner discouraging edits | No |
| Sensitivity labels / permissions | Home › Sensitivity (Microsoft 365 business) | Rights management controlled by your organisation | Yes, 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.
| A | B | |
|---|---|---|
| 1 | Loan calculator | |
| 2 | Loan amount | 20000 |
| 3 | Annual rate | 0.06 |
| 4 | Years | 5 |
| 5 | Monthly payment | 386.66 |
Inputs in B2:B4 should be editable; the formula in B5 must be protected.
Result: 386.66
- Select the input cells
B2:B4. - 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. - 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. - Choose Review › Protect › Protect Sheet.
- 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).
- Type a password if you want one (optional, and remember it), click OK, and confirm the password.
- Test: typing in
B5shows a message that the cell is protected; typing inB3works.
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.
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
- Choose Review › Protect › Protect Workbook.
- Keep Structure ticked and enter an optional password.
- 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
- Choose File › Info › Protect Workbook › Encrypt with Password (Mac: Review › Protect Workbook, or File › Passwords).
- Type a strong password and confirm it.
- Save the file. From now on Excel asks for the password before opening it.
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).
Check yourself
1. All cells are locked by default. Why can you still type in them?
Protection activates the Locked property.
2. What is the correct order to protect a form?
Unlocked cells stay editable once the sheet is protected.
3. Which option actually prevents someone without the password from opening the file?
Only encryption stops the file being opened.
4. You want to stop users unhiding a hidden sheet. What do you protect?
Structure protection disables Hide and Unhide.
5. What does ticking Hidden on the Protection tab do once the sheet is protected?
The cell still shows its result, but not the formula.