How to Protect Cells in Excel and Control Editing Safely

How-to basics · Updated November 19, 2026

To protect cells in Excel, first unlock the cells people should be able to edit, then protect the worksheet: 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 does not restrict editing until you protect the sheet.

What cell protection does—and does not do

Worksheet protection controls which actions people can take in a particular sheet. It is useful for keeping formulas, headings, and carefully arranged layouts from being changed by mistake while leaving designated entry cells available. A common setup is a form with blue input cells and locked labels or calculated totals.

Protection is applied to a whole worksheet, but it works through each cell’s Locked setting. You can therefore protect a sheet while allowing editing in chosen cells. It is not a way to make a workbook confidential or tamper-proof. Microsoft describes worksheet protection as a mechanism to prevent changes to locked cells; it should not be treated as strong security for sensitive information. For confidentiality, use file-level encryption and appropriate access controls, and do not distribute data that recipients should not see.

Prepare the cells before protecting the sheet

Plan which cells are inputs and which should stay fixed. In an expense template, for example, users might enter descriptions in B5:B20 and amounts in C5:C20, while the headings, instructions, and total formula remain protected. Excel’s default is that cells are marked Locked, so you generally need to change only the input cells.

  1. Select the cells intended for editing. To select separate ranges, hold Ctrl while selecting each range on Windows.
  2. Press Ctrl+1 to open Format Cells, then select the Protection tab. On a Mac, use Command+1; the Format Cells dialog has a Protection tab there as well.
  3. Clear the Locked check box and choose OK. This changes the cells’ setting but does not protect the worksheet yet.
  4. Review any other cells that should be editable, such as a comment or approval field, and unlock those too. Leave formulas and structural labels locked unless users genuinely need to change them.

You can also use Home > Format > Lock Cell to toggle the setting for a selection. The Format Cells dialog is often clearer because it shows the Locked and, where available, Hidden options together. Be careful when copying and pasting cells: pasted formatting can bring protection settings along with it, so check new input areas before distributing the workbook.

Protect the worksheet and choose allowed actions

Once the editable cells are unlocked, protect the sheet. In Excel for Microsoft 365 on Windows, select Review > Protect Sheet. In the dialog, you can enter an optional password and choose which actions remain available. For example, a data-entry sheet might allow users to select unlocked cells but not select locked cells. Choose OK, confirm the password if you set one, and test the result by trying to edit both an input cell and a protected formula cell.

Options in the Protect Sheet dialog can include selecting locked or unlocked cells, formatting cells, inserting or deleting rows and columns, sorting, using AutoFilter, and editing objects or scenarios. Select only what your users need. If users must filter a table, set up the filter before protecting the sheet and allow Use AutoFilter where that option is offered. Sorting and filtering can be restricted by other sheet conditions, so test the intended workflow rather than assuming every table action will remain available.

Protection applies to the active worksheet, not automatically to every sheet in the workbook. Repeat the process for each sheet that needs it. If an entire sheet should not be edited, you can leave all its cells locked and protect it without creating unlocked ranges. To remove worksheet protection, use Review > Unprotect Sheet and enter the password if prompted.

Keep formulas safe while leaving input cells editable

A useful design separates entry cells from calculated cells. For instance, a quotation sheet can leave quantity and unit-price cells unlocked while keeping the subtotal and final total locked. Use visual cues such as a consistent fill color, an input label, or a short instruction to show people where to type; color alone is not a substitute for clear labels.

If you want formulas not to appear in the formula bar when a cell is selected, select the formula cells and open Format Cells with Ctrl+1. On the Protection tab, select Hidden, then protect the sheet. Hidden affects formula display only while the sheet is protected. It does not conceal the calculated result shown in the cell, and it is not a secure way to hide confidential logic or data.

For shared templates, consider whether users need to insert rows or change formatting. Allowing those actions can make the sheet easier to use, but it may also weaken the layout you are trying to preserve. A practical approach is to permit the smallest set of actions needed, then test a copy of the workbook using the same tasks a typical user will perform.

Passwords, worksheet protection, and file security

A worksheet-protection password helps prevent casual changes and stops users from unprotecting the sheet through the normal command without the password. It is not equivalent to encrypting the workbook. If someone should not be able to open or read the file, use file encryption instead: in desktop Excel for Windows, go to File > Info > Protect Workbook > Encrypt with Password. This protects access to the workbook file, rather than merely restricting edits in selected cells.

Keep passwords in an approved password manager or another secure place, and provide them only to people who need them. If you lose a worksheet-protection password, Excel does not provide a normal recovery button that reveals it; you may need to restore an unprotected copy or contact the workbook owner. Do not rely on sheet protection as a substitute for backups, version history, or controlled sharing. Also remember that anyone with permission to edit a shared file may be able to make a separate copy or change its contents in ways that the protection settings do not prevent.

Protecting workbook structure and specific ranges

Protecting a sheet is different from protecting workbook structure. Sheet protection controls edits within a worksheet. Workbook-structure protection is intended to prevent actions such as adding, deleting, moving, hiding, or renaming sheets. In desktop Excel, use Review > Protect Workbook and select the structure option if it is shown, then set a password if appropriate. These protections can be used together, but neither should be confused with encrypting the file.

If a team needs different people to edit different areas, Excel also has an Allow Edit Ranges feature in supported desktop versions. On Windows, look under Review > Allow Edit Ranges. It lets you define ranges that can be edited under specified conditions, such as with a range password or Windows permissions in supported environments. Availability and behavior can differ by Excel version and organizational setup. For a simple form with a few shared input cells, unlocking those cells and protecting the sheet is usually easier to manage.

Differences in Excel for Mac and Excel for the web

On Excel for Mac, the basic idea is the same: set cells as locked or unlocked, then protect the worksheet. The Format Cells shortcut is Command+1 rather than Ctrl+1. Ribbon labels and dialog layouts can vary slightly between Mac releases, so look for the Protection tab in Format Cells and the sheet-protection command on the Review tab. Windows-only shortcuts such as Ctrl+1 should not be assumed to work on Mac.

Excel for the web supports worksheet protection in many current accounts, but its controls and available options may not match the desktop dialog. If you cannot find a particular setting, or need to set detailed permissions or workbook-structure protection, open the file in the desktop application and configure it there. After setting protection in one version, check the workbook in the version your collaborators use; shared workbooks can behave differently depending on app capabilities and permissions.

Common problems and how to fix them

  • Nothing happens when you mark cells Locked. Locking is only a cell setting. Use Review > Protect Sheet afterward to make it effective.
  • Users cannot type in an input cell. Unprotect the sheet, select the cell, clear Locked in Format Cells > Protection, and protect the sheet again. Confirm that the cell is not part of a locked merged range or otherwise affected by the sheet layout.
  • A formula can still be changed. Check that its cell is marked Locked, then confirm the worksheet is protected. A formula in an unlocked cell remains editable.
  • Users can select locked cells even though they cannot edit them. In Protect Sheet settings, clear Select locked cells if you want to prevent selection of locked cells. This is optional; selection alone does not mean the cell can be edited.
  • Filtering or sorting no longer works. Recheck the allowed-action options and whether the filter was already set up before protection. Some operations remain limited on protected sheets, so test with realistic data and adjust the design if needed.
  • The password does not work. Check keyboard layout and capitalization, and make sure you are removing protection from the intended sheet. Worksheet passwords and file-encryption passwords are separate. Excel does not provide a standard way to recover a forgotten protection password.

Good practices before sharing a protected workbook

Keep an unprotected master copy in a controlled location, and make a separate distribution copy when appropriate. Document which cells are intended for entry and what users should do if a required field is missing. Test the workbook with protection enabled: enter valid and invalid values, try expected navigation and filtering, and confirm that formulas and formatting stay intact. If the workbook is stored in OneDrive or SharePoint, use the service’s sharing permissions and version history as additional safeguards rather than assuming worksheet protection controls who can access the file.

Protection is most dependable when the workbook has a simple, deliberate design. Avoid unlocking broad areas just to make one small change possible, and avoid adding passwords that no owner can retrieve. When users need substantial freedom to edit data, a structured Excel table or a dedicated data-entry tool may be a better fit than a heavily protected sheet.

Frequently Asked Questions

Are Excel cells locked by default?
Yes. Cells are generally marked Locked by default, but that setting has no effect until you protect the worksheet. You can unlock selected cells first, then protect the sheet so those cells remain editable.

Can I protect only some cells in a worksheet?
You protect the worksheet as a whole, then choose which cells are editable by clearing Locked for those cells before protection. The remaining locked cells cannot be edited while sheet protection is active.

Can I protect cells without a password?
Yes. You can protect a sheet without setting a password. This still restricts actions according to the selected options, but anyone can remove protection through the normal command without needing a password.

Does protecting a worksheet encrypt my Excel file?
No. Worksheet protection limits editing actions; it does not encrypt the workbook or prevent someone with access from reading its contents. Use file encryption and appropriate sharing permissions when access to the data itself must be restricted.

How do I let people edit cells but not formulas?
Leave formula cells locked, unlock only the intended input cells, and then protect the worksheet. Test both types of cells after protection to verify that inputs accept changes and formulas do not.

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.