Can You Lock Cells in Excel? How Cell Protection Works

How-to basics · Updated November 21, 2026

Yes. In Excel for Microsoft 365 on Windows, you can lock selected cells by marking them as locked and then choosing Review > Protect Sheet. Because Excel marks every cell as locked by default, the key is usually to unlock the cells people should be able to edit before protecting the worksheet.

How cell locking works in Excel

Excel separates a cell’s lock setting from the protection that enforces it. A cell can be marked as locked without that setting having any effect while the worksheet is unprotected. When you turn on sheet protection, Excel then prevents users from changing locked cells, subject to the permissions you allow.

This arrangement lets you protect only part of a worksheet. For example, in an expense form, you might leave the date, employee, and amount fields open for entry while protecting formulas that calculate totals. People can fill in the intended fields without accidentally replacing the calculations.

Locking is a worksheet-level feature, not a separate password for each cell. You can set the Locked property for different ranges, but you enforce those settings by protecting the sheet. Protection applies to that worksheet; it does not automatically protect every sheet in the workbook.

Set up editable and locked cells

For a typical form, the most reliable setup is to unlock the entire sheet first, then lock the cells that should not be edited. This avoids relying on Excel’s default, which is that all cells are marked locked. In Excel for Microsoft 365 on Windows, use these steps:

  1. Select the whole worksheet by clicking the triangle at the top-left corner where the row numbers and column letters meet, or press Ctrl+A. If the active cell is inside a table, Ctrl+A can select the table first; press it again if needed to select the worksheet.
  2. Open Format Cells with Ctrl+1. On the Protection tab, clear the Locked check box, then select OK. This changes the lock setting; it does not yet protect the worksheet.
  3. Select the cells you want to keep fixed, such as formulas, headings, or instructions. Open Format Cells again, choose the Protection tab, select Locked, and click OK.
  4. Choose Review > Protect Sheet. In the dialog, select the actions users may perform on the protected sheet. You can set a password, but it is optional. Confirm the password if Excel asks, and keep a record of it if you use one.
  5. Test the result by trying to edit one unlocked input cell and one locked cell. The input cell should remain editable; Excel should block a change to the protected cell.

To lock only a few cells in a new, otherwise untouched sheet, you can skip the first two steps: all cells already have the Locked setting. Select Review > Protect Sheet to enforce it. However, this locks the entire worksheet, including cells that may later be needed for data entry, so check the intended layout before protecting it.

On Excel for Mac, the equivalent Format Cells shortcut is Command+1 rather than Ctrl+1. The sheet-protection command is also on the Review tab, though the dialog layout may differ by release. In Excel for the web, protection controls and available options can differ from the Windows desktop dialog; look on the Review tab for the sheet-protection or protection-management controls.

Choose what users can do on a protected sheet

The Protect Sheet dialog lets you allow some actions while blocking edits to locked cells. The available choices include actions such as selecting locked or unlocked cells, formatting cells, inserting rows, sorting, and using AutoFilter. Choose only the permissions your worksheet needs: allowing an operation may let users change parts of the sheet beyond simply entering data in unlocked cells.

For a straightforward input form, a useful setup is often to allow selecting unlocked cells while leaving locked cells unselectable. That makes the intended entry fields easier to navigate and reduces accidental clicks on formulas. For a reporting sheet, users may need to select locked cells to read or copy displayed values even though they cannot change them.

Consider the workflow before enabling sorting, filtering, or formatting. For example, someone may need to filter a protected table to find a record, but sorting can be restricted if it would affect locked cells. Test the exact actions that colleagues need after protection is on; a permission that sounds appropriate does not guarantee every operation will work in every worksheet layout.

Protect formulas while leaving input fields open

A common use is preventing users from overwriting formulas. Suppose a worksheet has quantities in column B, prices in column C, and line totals calculated in column D. You could unlock the intended entry cells in B and C, leave D locked, and protect the sheet. Users can enter quantities and prices, while the formulas in D remain protected from direct editing.

Protection does not stop Excel from recalculating a locked formula when its unlocked inputs change. It restricts users from editing the protected formula cell directly; it does not freeze the result or turn the formula into a fixed value. This distinction matters when a user expects a calculated total to update as they fill in the form.

You can also hide formulas from the formula bar by selecting the formula cells, opening Format Cells > Protection, and selecting Hidden before protecting the sheet. The Hidden setting only takes effect while the sheet is protected. It is intended to keep formulas out of casual view, not to make them secret or secure against someone determined to inspect the workbook.

Cell protection is not the same as workbook security

Worksheet protection is mainly a way to prevent accidental or routine changes to a sheet’s layout and contents. It should not be treated as strong security for confidential information. A protected sheet can still display its values, and worksheet protection is not a substitute for encrypting a file or controlling who can access it.

Excel also has workbook-structure protection, which is different. It can restrict actions such as adding, deleting, moving, hiding, or renaming worksheets. In Microsoft 365 for Windows, find it under Review > Protect Workbook. Use sheet protection to restrict edits to cells on a sheet; use workbook-structure protection when the arrangement of sheets should not be changed.

If a workbook contains sensitive data, consider who can open the file and where it is stored. Excel’s file-encryption option is separate from Protect Sheet; in the Windows desktop app, it is available through File > Info > Protect Workbook > Encrypt with Password. Use the appropriate organizational access controls as well, and avoid treating a worksheet password as confidentiality protection.

Common problems and how to fix them

  • Users cannot type anywhere. The worksheet may be protected while the intended input cells are still marked Locked. Unprotect the sheet, select those cells, clear Locked in Format Cells > Protection, and protect the sheet again.
  • Users can still change a cell. The worksheet may not be protected, or that cell may be unlocked. Check both the Locked setting and the sheet’s protection state.
  • A formula is visible. Locking prevents edits; it does not hide a formula. To hide it from the formula bar, set Hidden for the formula cells and then protect the sheet.
  • A user cannot sort or filter. Review the permissions selected in Protect Sheet. Some operations may also depend on how the range, table, or protected cells are arranged. Test the intended workflow on a copy before rolling it out.
  • The password is unavailable. Excel asks for the existing password when you unprotect a password-protected sheet. Keep passwords somewhere approved and accessible to the people responsible for maintaining the workbook; do not assume protection is a reliable recovery mechanism.

When changing a protected template, it is often safer to save a working copy first. Then unprotect the sheet, adjust the Locked or Hidden settings, and reapply protection. This helps preserve the original form and makes it easier to compare behavior before and after the change.

When to use other Excel features

Cell locking is a good fit when people need to use a workbook but should not casually overwrite formulas, labels, or layout. It is less suitable when the main goal is to collect information from many people with different access rights, keep an audit trail, or secure confidential data. A shared form or a controlled data-entry process may fit those needs better.

Other features solve different problems. Data Validation can restrict what users enter, such as requiring a whole number or choosing an item from a list; it does not prevent edits to locked cells by itself. Sheet protection can complement validation by keeping the input rules and formulas in place. File permissions and encryption address access to the workbook itself, rather than which cells can be changed after it is open.

Choose the lightest controls that suit the task. If users only need a few input fields, unlock those fields and protect the sheet. If they need to revise the worksheet structure, protection may create needless obstacles. If information must remain private, do not rely on hiding or locking cells; restrict access to the file or use an appropriate secure system.

Frequently Asked Questions

Are all cells locked by default in Excel?
Yes. Cells are generally marked as locked by default, but that setting has no effect until you protect the worksheet. To create editable fields, unlock those cells before turning on protection.

Can I lock just one cell in Excel?
Yes. Set the cell’s Locked property in Format Cells > Protection, then protect the worksheet. Other cells can remain unlocked if you clear their Locked settings before protecting the sheet.

Can people still see the contents of locked cells?
Yes. Locking normally prevents edits, not viewing. The optional Hidden setting can hide a formula from the formula bar after the sheet is protected, but it does not provide strong secrecy for the cell’s contents.

Can I protect a sheet without a password?
Yes. A password is optional in the Protect Sheet dialog. Protection can still prevent routine edits, but a password-free setup should not be considered a security barrier.

How do I unlock cells after protecting a sheet?
Choose Review > Unprotect Sheet. If a password was set, Excel will ask for it. Then select the cells and change the Locked setting through Format Cells > Protection as needed.

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.