To lock cells in Excel with a password, first unlock any cells people should still be able to edit, then protect the worksheet with a password: select the editable cells, press Ctrl+1, clear Locked on the Protection tab, and choose Review > Protect Sheet. Excel marks cells as locked by default, but that setting only takes effect after you protect the sheet.
These steps are for Excel for Microsoft 365 on Windows. Worksheet protection is useful for preventing accidental edits to formulas, labels, or layout while leaving designated input cells available. It is not a substitute for encrypting a file: people may be able to copy data from a protected sheet, and worksheet protection is not designed to keep sensitive information confidential.
What You’ll Need
- An Excel workbook saved in a format that supports worksheet protection, such as .xlsx.
- A clear idea of which cells should stay editable and which should be protected. For example, you might leave cells for entering quantities open while protecting formula cells.
- A password you can store safely. Excel does not provide a dependable way to recover a forgotten worksheet-protection password, so do not rely on memory alone.
Step-by-Step
- Make a copy and identify the cells. Save your workbook, or use File > Save As to create a working copy before changing protection. Mark the cells that users should be allowed to edit, such as blank entry fields, and note the formulas or headings that should remain protected. If you want every cell protected, you can skip the unlocking steps below and go straight to protecting the sheet.
- Select the cells that should remain editable. Click the first input cell, then drag across the range. To select separate ranges, hold Ctrl while selecting each additional range. If the editable cells are spread across a worksheet, you can select one range, unlock it, and repeat for the others. Take care not to include formula cells just because they sit beside the input fields.
- Clear the Locked setting for those cells. With the editable cells selected, press Ctrl+1 to open Format Cells. Select the Protection tab, clear the Locked checkbox, and click OK. This does not immediately change what users can edit; it marks those cells as unlocked so they will remain editable after sheet protection is turned on. On a Mac, use Command+1 to open Format Cells; the dialog has the same Protection setting.
- Check that cells you want protected are still locked. Select a formula cell or other cell that should not be changed and press Ctrl+1. On the Protection tab, make sure Locked is checked, then click Cancel or OK. Excel normally has Locked checked for cells by default. If you previously unlocked the whole worksheet, select the cells to protect and check Locked for them. You can select the entire worksheet by clicking the small Select All triangle where the row and column headings meet, but do this only if you intend to change the setting for every cell.
- Open the sheet-protection controls. Go to the Review tab and select Protect Sheet. In the Protect Sheet dialog, confirm that Protect worksheet and contents of locked cells is selected. The dialog also lists actions users may be allowed to perform, such as selecting locked or unlocked cells. Leave only the permissions that fit your worksheet. For a simple form, allowing selection of unlocked cells while preventing selection of locked cells can make it easier to move between entry fields.
- Enter and confirm a password. Type a password in the password field and choose the allowed actions. Click OK, type the same password again when prompted, and click OK to confirm. The password is generally case-sensitive. Store it in a password manager or another secure place that authorized editors can access. If you leave the password blank, sheet protection can still prevent casual changes, but anyone can remove that protection without knowing a password.
- Test the result before sharing the workbook. Try to type into a cell you intended to protect; Excel should display a message that the cell is protected. Then try an unlocked input cell and confirm it accepts an entry. If either result is wrong, use Review > Unprotect Sheet, enter the password, correct the cell settings, and protect the sheet again. Save the workbook after you confirm both types of cells behave as intended.
When the sheet is protected, you can still view and select cells according to the permissions you chose. Protection does not hide formulas or prevent someone from viewing the worksheet. If formulas themselves should not be visible in the formula bar, Excel has a separate Hidden setting on the Protection tab, but that setting also takes effect only after the sheet is protected. It is intended to limit casual viewing, not to secure confidential calculations.
Common Mistakes
- Locking cells but not protecting the worksheet. The Locked checkbox is only a cell setting until you use Review > Protect Sheet. If users can still edit everything, check whether sheet protection is actually on.
- Expecting only selected cells to be locked automatically. Excel marks all cells as locked by default. If you protect the sheet without unlocking the intended input cells first, the whole sheet may become read-only to users.
- Unlocking the wrong range. A selection that includes a formula or a heading makes that cell editable after protection. Check the selected range carefully, especially when using Ctrl to select multiple areas.
- Confusing worksheet protection with file encryption. Protect Sheet is meant to limit editing, not to stop people from opening, copying, or extracting workbook contents. Use file-level encryption or access controls for confidential information.
- Forgetting the password or relying on a blank one. A forgotten password can leave you unable to unprotect the worksheet through normal Excel controls. A blank password offers little barrier to someone who knows where the command is.
- Protecting the wrong sheet. Protection applies to the active worksheet, not automatically to every sheet in the workbook. Check the sheet tab before choosing Protect Sheet, and repeat the process for each sheet that needs it.
Tips
- Use a consistent input-cell format. Give editable cells a distinct fill color or border and add a short note explaining what users should enter. Formatting is only a visual cue, so still unlock the cells and protect the sheet.
- Decide which actions users need. In the Protect Sheet dialog, permissions can allow actions such as formatting cells, inserting rows, or sorting. Do not enable extra actions automatically; test the specific tasks users need because protection can restrict some operations even when a related permission is checked.
- Protect each relevant worksheet. A workbook can contain multiple sheets, and protecting one does not protect the others. You can also protect workbook structure separately to limit changes such as adding, deleting, moving, or renaming sheets. That is a different command from protecting the cells on a sheet.
- Keep a clean unprotected master. If you distribute protected copies, save an editable master in a controlled location. This gives you a straightforward version to update if the layout, formulas, or password needs to change.
- Use a stronger control for sensitive data. If the goal is to restrict who can open the workbook, use Excel’s file encryption option rather than relying on worksheet protection. In Excel for Windows, look under File > Info > Protect Workbook for the option to encrypt with a password. Keep a secure backup of the password because losing it can prevent access to the file.
- Account for platform differences. The Windows route in this guide uses Review > Protect Sheet. Excel for Mac has corresponding sheet-protection controls on the Review tab, though dialog layout can vary by release. Excel for the web may not expose all desktop protection settings; use the desktop app when you need to set up or adjust the full set of permissions.
Troubleshooting
I can still edit a cell that should be locked. Confirm that the worksheet is protected, then select the cell and check Format Cells > Protection. Locked must be checked. If the cell was unlocked, unprotect the sheet first, check Locked, and protect the sheet again. Also verify that you are testing the intended worksheet rather than another tab with similar content.
I cannot edit a cell that should be an input. Unprotect the sheet using Review > Unprotect Sheet and enter the password. Select the input cell, open Format Cells with Ctrl+1, and clear Locked on the Protection tab. Protect the sheet again and test the cell. If the cell is part of a merged range or a table, check the actual selected cell or range carefully so you change the intended area.
Protect Sheet is unavailable or the workbook behaves differently. Check whether the workbook is in a restricted state, such as being opened read-only, or whether the file is being edited in a version of Excel with fewer protection controls. If you are using Excel for the web, open the workbook in the desktop app and check the Review tab. A shared editing or organizational policy may also limit available options; ask the workbook owner or administrator if the command remains unavailable.
I forgot the sheet password. Try your password manager, organization records, or the person who created the workbook. Excel does not offer a normal password-recovery process for worksheet protection. If you have an unprotected master or an earlier backup, use that copy. Do not assume that the password protecting a worksheet is the same as a password required to open the workbook; those are separate protections.
Users cannot sort or use another feature after protection. Unprotect the sheet, then protect it again with the necessary action allowed in the Protect Sheet dialog. Some worksheet operations have additional requirements, and an enabled permission does not guarantee every operation will work in every layout. Test with a representative user task before distributing the file.
Frequently Asked Questions
Does locking a cell require a password?
No. You can protect a worksheet without setting a password. A password adds a barrier to removing protection, while the Locked setting controls which cells are editable once the sheet is protected.
Can I lock only some cells and leave the rest editable?
Yes. Unlock the cells that should remain editable, leave Locked checked for the others, and then protect the worksheet. Excel starts with all cells marked locked, so unlocking the entry cells is usually the key step.
Can I use a different password for each worksheet?
Yes. Each worksheet can be protected separately with its own password, or you can reuse a password if that suits your workflow. Keep track of which password belongs to which sheet and share it only with people who need to make changes.
Does worksheet protection encrypt my data?
No. Sheet protection is designed to limit editing, not to secure data from viewing or copying. For information that should not be accessible to unauthorized people, use file encryption and appropriate storage permissions.
How do I remove the password or change the protected cells?
Choose Review > Unprotect Sheet and enter the current password. Make the cell-setting changes, then choose Review > Protect Sheet and set protection again. If you only want to change which actions are allowed, you still need to unprotect and reapply the sheet settings.
Related
- Clean Excel Data: Practical Steps, Tools, and Common Fixes
- Lower Excel Data Load: Speed Up Large Workbooks
- Lower Excel Calculation Time: How to Speed Up Workbooks
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- How to Insert Dotted Lines in a Word Table of ContentsTo insert dotted lines between entries and page numbers in a Microsoft Word table of contents, go to…
- Excel Heat Map Color Codes: How to Choose and ApplyExcel has no single set of required heat map color codes: a heat map is usually a Conditional…
- Excel Tips and Shortcuts for Faster, Cleaner WorkbooksFor faster Excel work, learn a few reliable Windows shortcuts, turn data ranges into tables, and use formulas…
- Clear Outlook Cache: Safe Steps and What They RemoveYes—clear an Outlook cache when it is causing a specific problem, but first identify which cache you mean.…
- Best Way to Set Out of Office in Outlook AutomaticallyThe best way to set out of office in Outlook is to use Automatic Replies on your Microsoft…
- Basic Excel Shortcut Keys: A Practical Guide for WindowsFor Excel for Microsoft 365 on Windows, the basic shortcut keys include Ctrl+C to copy, Ctrl+V to paste,…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.