How to lock cells in Excel to protect formulas
In Excel, every cell is Locked by default, but locking only takes effect when you protect the sheet. So: select the cells people should be able to edit, press Ctrl+1 > Protection > untick Locked > OK. Then go to Review > Protect Sheet, add an optional password and click OK.
All other cells (such as formulas) are now locked.
Applies to Excel for Microsoft 365, Excel 2016-2024 and Excel for Mac. Excel for the web can apply and remove protection in current versions, but managing passwords is easiest in the desktop app.
Lock cells and protect the sheet
- Select the input cells that others should be allowed to change.
- Press Ctrl+1 (Mac: Cmd+1) to open Format Cells.
- Open the Protection tab, untick Locked and click OK.
- Go to Review > Protect Sheet.
- Type a password (optional) and choose what users can still do, for example Select unlocked cells, Format columns or Use AutoFilter.
- Click OK and confirm the password.
Lock only formula cells
- Select the whole sheet (Ctrl+A), press Ctrl+1 > Protection, untick Locked.
- Press F5 > Special > Formulas > OK to select every formula.
- Press Ctrl+1 > Protection, tick Locked (and Hidden if you don't want the formula shown in the formula bar).
- Review > Protect Sheet.
Unprotect a sheet
Go to Review > Unprotect Sheet and enter the password. Microsoft can't recover lost sheet passwords, so store yours somewhere safe.
Protect sheet vs protect workbook vs encrypt
- Protect Sheet stops edits to locked cells.
- Protect Workbook (Review tab) stops people adding, deleting, renaming or moving sheets.
- File > Info > Protect Workbook > Encrypt with Password stops people opening the file at all. Sheet protection is not real security - it's designed to prevent accidental changes.
Frequently asked questions
Why can I still edit locked cells?
The sheet isn't protected yet. Locking only works after Review > Protect Sheet.
Can different people edit different ranges?
Yes, with Review > Allow Edit Ranges (Windows desktop) before protecting the sheet.
Does locking cells work in shared workbooks?
In files shared via OneDrive or SharePoint, sheet protection still applies to all co-authors.