How to Lock Cells and Protect Sheets in Excel
Published October 18, 2026 · By Ahmad Parvez
Locking cells in Excel is one of the most-searched spreadsheet skills — how to lock cells in Excel alone gets searched thousands of times a month — and it's also one of the most misunderstood. People tick the Locked checkbox, share the file, and only later discover that anyone could still change everything. This guide fixes that: the real two-step workflow for locking cells, rows and columns; how to password-protect the file itself (a different thing entirely); how to unprotect and unlock when you need to; and honest answers about forgotten passwords.
The thing most guides get backwards: "Locked" does nothing until you protect the sheet
Open any new workbook, select a cell, press Ctrl+1, and look at the Protection tab: the Locked checkbox is already ticked. Every cell in Excel ships with Locked switched on. And it means nothing. You can tick and untick that box all day — without sheet protection, every cell stays fully editable.
Once you internalize that, everything else clicks into place:
- To lock the whole sheet: you barely have to do anything — all cells are already Locked, so just go to Review → Protect Sheet and set a password. Done.
- To lock certain cells (formulas, totals, labels) while letting people fill in the rest: select the cells people may change, uncheck Locked on those, then protect the sheet. You unlock the editable parts; everything else was already locked by default.
- To unlock cells later: unprotect the sheet first (Review → Unprotect Sheet) — you cannot change the Locked flag while protection is on — then uncheck Locked and re-protect.
The two-minute proof: tick Locked on a cell, try typing in it — it works, protection isn't on. Now go to Review → Protect Sheet, set any password, and try typing again. Now it's locked. That's the whole mental model.
How to lock certain cells in Excel (formulas locked, inputs editable)
This is the classic use case: a budget, invoice or form where people should fill in the inputs but must not touch the formulas. If your sheet is full of formulas — for example ones built with our Excel Formula Builder — this is how you keep them safe.
- Select the cells people MAY change. Hold Ctrl and click to select several ranges at once — for example all the yellow input cells in a form.
- Unlock just those cells: press Ctrl+1 (on a Mac, Cmd+1), open the Protection tab, uncheck Locked, and click OK. (You can also find this at Home → Format → Lock Cell, which toggles the same flag.)
- Protect the sheet: go to Review → Protect Sheet. Type a password (strongly recommended — without one, anyone can unprotect in two clicks), confirm it, and click OK.
Test it: click a formula cell and try typing — Excel refuses. Click an input cell — it works. That's exactly the split you want.
The backwards mistake: most people select the formula cells and tick Locked — but they were already locked. What actually matters is unchecking Locked on the cells that must stay editable. If you get this backwards, you'll lock the inputs and leave the formulas editable — the exact opposite of what you wanted.
Tip: pair locked formula cells with dropdown lists on the editable input cells. Locking decides where people can type; a dropdown decides what they're allowed to type there. Together they make a form nearly foolproof.
How to lock a row in Excel
"Lock a row" usually means one of two things — stop people changing a row (protection), or keep it visible while scrolling (freezing). For visibility, see the FAQ on freezing header rows. For protection, the reliable recipe is:
- Unlock everything first: click the corner button above row 1 and left of column A (or press Ctrl+A) to select the whole sheet, press Ctrl+1, open the Protection tab, uncheck Locked, and click OK.
- Lock just your row: click the row number on the left to select the entire row, press Ctrl+1 again, and this time check Locked.
- Protect the sheet: Review → Protect Sheet, set a password, and confirm.
Now that one row rejects every edit while the rest of the sheet stays editable. The same recipe works if you want to lock two or three rows — select them together in step 2.
How to lock a column in Excel
Identical to locking a row, but with the column letter instead of the row number:
- Select the whole sheet (Ctrl+A), press Ctrl+1, and uncheck Locked on the Protection tab.
- Click the column letter at the top to select the entire column, press Ctrl+1, and check Locked.
- Go to Review → Protect Sheet, set a password, and confirm.
Need to lock rows and columns at once? Select both in step 2 — click the row number, hold Ctrl, and click the column letter — then check Locked once for the whole selection. And if you ever need to reverse it, unlock the cells the same way in reverse: unprotect the sheet, uncheck Locked, re-protect.
How to protect a sheet in Excel (and what every checkbox means)
The Protect Sheet dialog isn't just a password box — the list of checkboxes decides what people can still do on a protected sheet. The defaults are conservative: users can select cells but change almost nothing. The ones worth knowing:
| Checkbox | What it allows | When to tick it |
|---|---|---|
| Select locked cells | Clicking on locked cells | Ticked by default. Untick it for clean forms so users can only tab through the input cells. |
| Select unlocked cells | Clicking on editable cells | Keep ticked — unticking it makes the sheet nearly unusable. |
| Format cells / columns / rows | Changing fonts, colors, widths | Tick when people need to restyle without touching values. |
| Insert / Delete columns or rows | Adding or removing structure | Tick for living documents like logs people extend daily. |
| Sort | Sorting data on the sheet | Tick for any shared table people need to reorder. |
| Use AutoFilter | Using existing filter dropdowns | Tick for shared tables — but apply the filters before protecting. |
| Edit objects | Moving or editing charts and shapes | Tick if the sheet has charts people need to adjust. |
The sorting/filtering trap: protecting a sheet blocks sorting and filtering unless you tick those two boxes in the dialog. And for AutoFilter, the filter dropdowns must already be applied to your data before you protect — ticking the box afterwards on a sheet with no filters changes nothing. If sorting is mysteriously blocked on a sheet you received, this is almost always why: it was protected without those boxes ticked. The fix is to unprotect the sheet and protect it again with them ticked.
How to password protect an Excel file (this is different from sheet protection)
This is where many people get burned: protecting a sheet and password-protecting a file are two different things. Sheet protection controls what people can change once the file is open. File protection (encryption) controls who can open it at all. Here's how to lock the file itself:
- With the workbook open, go to File → Info.
- Click Protect Workbook and choose Encrypt with Password.
- Type a password, click OK, re-enter it, and click OK again.
- Save the file (Ctrl+S) — the encryption only takes effect once you save.
From now on, Excel asks for the password before the file even opens. This uses real AES encryption — it is actual security, unlike sheet protection, which is only a deterrent against accidental edits.
Two close relatives worth knowing:
- Password to modify: in the Save As dialog, click Tools → General Options. You can set a "password to open" and a separate "password to modify" — with only the second set, anyone can open the file read-only, but editing requires the password. This is the genuine answer to "how do I make an Excel file read-only with a password."
- Protect Workbook structure: on the Review tab, Protect Workbook (with the Structure box ticked) stops people adding, deleting, renaming, hiding or reordering sheets — it says nothing about cells. A protected sheet can still be moved or copied to another workbook, and the protection travels with it.
Warning: if you forget a file encryption password, the file is gone for good — Excel offers no recovery, no "forgot password" link, no backdoor. Write it down somewhere safe the moment you set it.
How to unprotect an Excel sheet
If you know the password, unprotecting takes ten seconds:
- Go to the protected sheet and click the Review tab.
- Click Unprotect Sheet.
- Type the password and click OK. If no password was set, just click OK.
The button toggles: once a sheet is unprotected, the same button reads "Protect Sheet" again. To unprotect the workbook structure (locked sheet tabs), it's Review → Protect Workbook → enter the password → untick Structure → OK.
How to remove a password from Excel
There are three different "passwords" in Excel, and the answer depends on which one you mean:
1. You know the sheet password and want it gone. Unprotect the sheet (Review → Unprotect Sheet → enter the password), then save the file. The password is removed with the protection. If you want to keep the sheet protected but drop the password, unprotect it and then protect it again, leaving the password boxes blank.
2. You forgot the sheet password. Here is the honest answer: Excel offers no official way to recover a forgotten sheet password. The legitimate routes are asking whoever protected the sheet, and checking for an unprotected backup — an earlier version in OneDrive, a copy in your email, or the file as it existed before protection was added. Be cautious of websites promising to strip the password if you upload the file: you'd be handing your spreadsheet to a stranger's server, and many keep a copy of what you send.
3. You forgot the file encryption password. This one is final: a forgotten Encrypt-with-Password password cannot be legitimately removed. The file is encrypted with AES, and neither Microsoft nor anyone else can open it without the password. Anyone claiming otherwise is selling you something. This is why the warning above matters — treat a file password like a safe combination, not a sticky note.
How to unlock cells in Excel
Unlocking is the mirror image of locking, and it has one rule people always forget: you cannot change the Locked flag while the sheet is protected.
- Unprotect the sheet first: Review → Unprotect Sheet → enter the password.
- Select the cells you want to make editable (a row, a column, or any range).
- Press Ctrl+1, open the Protection tab, uncheck Locked, and click OK.
- Re-protect the sheet (Review → Protect Sheet) so everything else stays locked.
To unlock an entire sheet — for example, to hand a finished template back to its owner — select the whole sheet with Ctrl+A after unprotecting, uncheck Locked once, and you're done.
How to make an Excel file read-only (and how to turn read-only off)
Sometimes you don't want locks at all — you just want the file to open in read-only mode so nobody saves over the original by accident. Excel gives you four ways, from gentle nudge to firm:
- Always Open Read-Only (gentlest): File → Info → Protect Workbook → Always Open Read-Only. Excel suggests read-only on open, but the user can click "No" and edit anyway. Good for shared templates.
- Mark as Final: File → Info → Protect Workbook → Mark as Final. The file opens read-only with a "marked as final" notice. Anyone can undo it in two clicks — it's a signal, not a lock.
- Password to modify: File → Save As → Tools → General Options → set a "password to modify." Anyone can open and read, but saving changes needs the password. The closest thing to read-only with teeth.
- Operating-system read-only: right-click the file → Properties → tick Read-only. Blocks all writes at the file level until unticked.
Stuck in read-only and want out? Work through the causes: if a yellow bar says Protected View, click Enable Editing (downloaded and emailed files open this way by default). Check File → Info for Always Open Read-Only or Mark as Final flags and switch them off. Right-click the file and untick the read-only attribute. If it asks for a modify password on save, use Save As to create a fresh copy without it.
Locked vs hidden: hiding your formulas
The Protection tab in the Format Cells dialog has a second checkbox most people never notice: Hidden. While Locked stops people changing a cell, Hidden stops them seeing the formula in the formula bar. Tick both on your formula cells before protecting the sheet, and other people will see the calculated values but not the logic behind them.
Like Locked, Hidden does nothing until the sheet is protected — and like locking, it can be reversed by anyone who unprotects the sheet, so treat it as privacy from casual viewers, not security. If you're tidying up a sheet's visibility more broadly, our guide to hiding and unhiding in Excel covers rows, columns and sheets (including Very Hidden sheets, which pair well with workbook structure protection).
Locking cells in Excel for the web and OneDrive
If you keep your files on OneDrive and edit in the browser, most of this guide still applies — with a few limits:
- Protecting a sheet works in Excel for the web: open the file, go to Review → Protect Sheet, set a password, and the sheet locks. Unprotecting works the same way.
- The fine-grained checkboxes don't: the web version protects with default permissions — the full list of allow-sort, allow-filter and formatting options is desktop-only. Set those in desktop Excel first, then upload.
- File encryption is desktop-only: Encrypt with Password must be applied in desktop Excel before the file goes to OneDrive. A file encrypted on desktop will ask for the password when opened in the browser too.
7 mistakes that silently leave your sheet unprotected
| Mistake | Why it fails | Fix |
|---|---|---|
| Ticked Locked, never protected the sheet | The flag is inert without protection | Review → Protect Sheet — always the last step |
| Protected first, then tried to change Locked flags | Flags are frozen while protected | Unprotect, change the flags, re-protect |
| Locked the input cells instead of unlocking them | Backwards selection — formulas editable, inputs locked | Unlock the cells people may edit; the rest was already locked |
| Used sheet protection as security | It's a deterrent, not encryption | Encrypt with Password for real security |
| Forgot the file password | AES encryption has no recovery | Store it somewhere safe the moment you set it |
| Sorting/filtering blocked on a shared sheet | Protected without those boxes ticked | Unprotect and re-protect with Sort + AutoFilter ticked |
| Hid a sheet instead of protecting the workbook | Hidden sheets are one right-click away | Very Hidden + Protect Workbook structure |
One more piece of housekeeping: before you lock a sheet down, make sure the data is clean — removing duplicates first means nobody gets locked into a sheet with bad data baked in.
Frequently asked questions
Can I protect cells in Excel without protecting the sheet?
No — there is no way to make cells uneditable without protecting the sheet. The Locked checkbox is only enforced when sheet protection is switched on. The closest alternatives are file-level nudges: File → Info → Protect Workbook → Always Open Read-Only, Mark as Final, or a password to modify. None of them truly lock cells; a determined user can get around all three. If cells must be uneditable, protect the sheet.
How do I unprotect an Excel sheet if I forgot the password?
Excel offers no official way to recover a forgotten sheet password, so start with the legitimate routes: ask whoever protected the sheet, and check for an unprotected backup copy or an earlier version in OneDrive or your email. Be wary of websites that promise to remove the password if you upload the file — you would be handing your spreadsheet to a stranger's server, and many of them keep a copy.
How do I lock cells in Excel for the web or OneDrive?
Open the file in Excel for the web, select the sheet, and go to Review → Protect Sheet — you can set a password and lock the sheet right in the browser. The fine-grained permission checkboxes (allow sorting, filtering, formatting and so on) are desktop-only, and file-level encryption with a password must be applied in desktop Excel before uploading.
Why does my Excel file keep opening as read-only?
Usually one of five things: Protected View is blocking a downloaded file (click Enable Editing in the yellow bar), the file was saved with Always Open Read-Only, it was marked as final, the operating system flagged the file itself as read-only, or it was saved with a password to modify. Open the file, check File → Info for any Protect Workbook flags, and right-click the file to check its read-only attribute.
What is the difference between protecting a sheet and password-protecting a file?
Protecting a sheet controls what people can change inside the workbook — which cells are editable. Password-protecting a file (Encrypt with Password) controls who can open it at all. Sheet protection is a deterrent against accidental edits; file encryption uses real AES encryption and is actual security. For sensitive data, use both.
How do I lock a header row so it stays visible when I scroll?
That is a different feature called freezing, not locking. Select the row below your header, then go to View → Freeze Panes → Freeze Panes (or Freeze Top Row if your header is row 1). Locking a row prevents people from changing it; freezing pins it on screen while you scroll.
Is there a keyboard shortcut to lock cells in Excel?
There is no single keystroke that locks cells, but the fast path is: select the cells, press Ctrl+1 to open Format Cells, go to the Protection tab, and tick or untick Locked. Then press Alt and follow the ribbon keytips to Review → Protect Sheet. On a Mac, use Cmd+1 instead of Ctrl+1.
Can people still sort and filter a protected sheet?
Yes, but only if you allow it before protecting: tick Sort and Use AutoFilter in the Protect Sheet dialog, and make sure the filter dropdowns are already applied to your data before you protect the sheet. If sorting is still blocked afterwards, the sheet was protected without those boxes ticked — unprotect it and protect it again with them ticked.