How to Lock Cells in Excel to Prevent Editing on a Sheet

How-to basics · Updated November 18, 2026

To lock cells in Excel, first decide which cells people should still be able to edit, unlock those cells if needed, and then protect the worksheet. Excel marks cells as locked by default, but that setting has no effect until sheet protection is turned on. These steps are for Excel for Microsoft 365 on Windows and help prevent routine changes; they are not a substitute for encrypting a workbook containing sensitive information.

What You’ll Need

  • An Excel workbook you can edit. If it is read-only or protected already, you may need permission or the existing password before changing its protection settings.
  • A clear plan for which cells should be editable, such as blank input cells, and which should be protected, such as formulas or headings.
  • Optional: a password for sheet protection. You can protect a sheet without one, but anyone with access can then remove protection easily. Store any password you do use somewhere safe.

Step-by-Step

  1. Open the worksheet and identify the editable cells. Decide whether the sheet should be entirely read-only or whether some cells must remain available for data entry. For example, in an expense form you might leave the date and amount fields editable while protecting labels and calculated totals. If the workbook has several sheets, repeat the protection process separately for each sheet that needs it.
  2. Choose the right setup for your sheet. If every cell should be protected, you can usually leave the default Locked setting in place and go straight to protecting the sheet in step 4. If some cells should remain editable, unlock those cells first. If you only want a particular range locked while other cells stay editable, unlock the whole worksheet first, then lock the range you want to protect. The following steps cover both cases.
  3. Unlock cells that users should be allowed to edit. Select the cells, or ranges, that should remain editable. To select the entire worksheet, click the Select All button at the junction of the row numbers and column letters. On the Home tab, in the Cells group, choose Format > Format Cells. You can also press Ctrl+1 on Windows; on Mac, press Command+1. In the Format Cells dialog, open the Protection tab, clear the Locked checkbox, and select OK. The cells are now marked as unlocked, but this does not protect or expose them by itself. If only a few cells should be editable, select just those cells rather than the entire sheet.
  4. Lock a specific range if you unlocked the whole worksheet. Skip this step if you want all cells protected or if you only unlocked selected input cells in step 3. Select the range you want to protect, open Home > Format > Format Cells, and go to the Protection tab. Make sure Locked is checked, then select OK. Excel marks cells as locked by default, so this step is mainly necessary after you have unlocked the whole sheet. If you are unsure which ranges are locked, check them with the same Format Cells dialog before continuing.
  5. Turn on worksheet protection. Open the Review tab and select Protect Sheet. In the dialog, leave Protect worksheet and contents of locked cells selected. Enter a password if you want to require one to unprotect the sheet, then enter it again if Excel asks you to confirm. A password is optional. Do not choose a password you cannot retrieve: Excel does not provide a normal password-recovery option for sheet protection.
  6. Choose what users may do and confirm. In the Protect Sheet dialog, review the list of permitted actions. Select Select unlocked cells if users need to move between editable fields. Select Select locked cells only if users should be able to select protected cells; clearing it can make the sheet easier to use as a form. Other permissions, such as formatting cells or sorting, should be enabled only when needed. Select OK, and confirm the password if prompted. Test an unlocked cell and a locked cell to check the result.
  7. Save the workbook and check the protection after reopening. Save the file, then make sure the worksheet behaves as intended. A locked cell should reject edits while protection is on; an unlocked cell should accept them. If you rely on the protection for a shared form, test a copy of the workbook or ask a colleague to try the intended workflow before distributing the original.

To remove protection later, open Review > Unprotect Sheet. Enter the password if Excel requests it. Removing protection lets you change the Locked settings again; it does not erase the cell contents or formulas.

Common Mistakes

  • Locking cells but not protecting the sheet. The Locked checkbox is only a cell setting. It takes effect when you select Review > Protect Sheet. Without protection, people can still edit those cells normally.
  • Forgetting that cells are locked by default. If you protect the sheet without first unlocking intended input cells, users may be unable to enter data anywhere. Set up the unlocked areas before turning protection on.
  • Unlocking the wrong range. Check the selected cells before changing the Locked setting. A selection that includes a formula cell could leave that formula editable. Use the Name Box to select a known range, or review the selection visually before opening Format Cells.
  • Assuming sheet protection is strong security. Worksheet protection is designed mainly to prevent accidental edits and limit ordinary actions. It should not be treated as encryption or as a way to securely hide confidential information. Use appropriate file encryption and access controls for sensitive workbooks.
  • Setting a password without keeping a record. If you forget the password, you may not be able to unprotect the sheet through Excel. Keep a copy in an approved password manager or follow your organization’s password-storage rules.
  • Protecting the wrong sheet. Protection applies to the active worksheet, not automatically to every worksheet in the workbook. Check the sheet tab before using Protect Sheet, and repeat the process on other tabs as required.

Tips

  • Make input areas obvious. Use a consistent fill color, border, or short instruction such as Enter information in the shaded cells. Formatting does not control editing, but it helps users distinguish unlocked cells from protected ones.
  • Check formulas before protecting. Select a formula cell and confirm that Locked is checked in Home > Format > Format Cells > Protection. If users should not see a formula in the formula bar, the same dialog has a Hidden option, but it also takes effect only after the sheet is protected.
  • Allow only the actions people need. For a simple form, users may need to select unlocked cells and enter values, but not format rows or delete columns. Fewer permissions make accidental changes less likely. Test actions such as sorting or filtering before relying on them; their behavior can depend on the sheet setup.
  • Use a separate copy while setting up protection. This is especially useful when the sheet contains complex formulas, data validation, or important formatting. After checking the locked and unlocked areas, save the final version under the appropriate workbook name.
  • Remember that protection is per worksheet. A workbook with five tabs may need protection enabled on five separate sheets. A protected sheet does not automatically protect workbook structure, such as adding, deleting, or renaming tabs; that is a separate protection setting.

Troubleshooting

  • I can still edit a cell that should be locked. Confirm that sheet protection is active by checking Review for the Unprotect Sheet command. If protection is active, select the cell, open Home > Format > Format Cells > Protection, and verify that Locked is checked. Then protect the sheet again if you changed the setting.
  • I cannot type in any cells. The input cells may still be locked. Unprotect the sheet, select the cells that should accept entries, clear Locked in the Protection tab of Format Cells, and protect the sheet again. Check that Select unlocked cells is allowed in the Protect Sheet options.
  • Protect Sheet is unavailable or I cannot change the settings. Check whether the workbook opened in read-only mode, whether you have editing permission, or whether the worksheet is already protected. If it is protected, use Review > Unprotect Sheet and provide the password. A shared or organization-managed file may also have access restrictions that you cannot change yourself.
  • The password is rejected. Passwords are case-sensitive, so check capitalization and keyboard language. If the sheet was protected by someone else, ask that person or the workbook owner for the correct password. Excel does not offer a standard way to recover a forgotten worksheet-protection password.
  • The menus look different in Excel for Mac or the web. On Mac, use the Review tab for sheet protection and Command+1 to open Format Cells; the dialog labels may be arranged differently from Windows. Excel for the web has a different interface and may not expose every desktop protection option. If you cannot find a needed permission, open the workbook in the Excel desktop app and make the change there.

Frequently Asked Questions

Can I lock only some cells in Excel?
Yes. Unlock the cells that should remain editable, leave the target cells locked, and then protect the worksheet. You can also unlock the whole sheet first and lock only the specific range you want protected.

Why are cells locked by default if I can still edit them?
Excel stores a Locked setting for cells by default, but the setting is inactive until you protect the worksheet. Turning on sheet protection makes the locked setting take effect.

Can users edit unlocked cells after I protect a sheet?
Yes, provided those cells have Locked cleared and the Protect Sheet options allow users to select unlocked cells. Protection blocks edits to locked cells while leaving unlocked cells available for entry.

Can I lock cells without a password?
Yes. Leave the password field blank when you select Review > Protect Sheet. The sheet will still restrict edits, but another person with access can unprotect it without entering a password.

Does locking cells hide formulas?
No. Locked prevents editing while sheet protection is on; it does not hide a formula. To hide a formula from the formula bar, select the cell, choose Home > Format > Format Cells > Protection, check Hidden, and then protect the sheet.

Does Protect Sheet protect the entire workbook?
No. It protects the active worksheet. Protect other sheets separately, and use workbook-structure protection if you need to restrict actions such as adding, deleting, or renaming sheets.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.