How to Lock Cells in Excel (and Keep Others Editable)

Locking cells in Excel takes two settings working together. First, mark the cells as Locked (and the others as unlocked) in Format Cells > Protection. Second, turn on Review > Protect Sheet. Until the sheet is protected, the Locked setting does nothing, which is why so many people tick the box and find they can still type over their formulas.

Here’s the part that trips up almost everyone: every cell in a new workbook is already marked Locked. So if you simply protect the sheet, you lock the entire thing. To lock only some cells, you unlock everything first, then re-lock the cells you want to protect. The steps below are for Excel for Microsoft 365, Excel 2024, 2021, 2019 and 2016 on Windows. Mac and the web version follow in their own sections.

How locking actually works

Think of Locked as a label and Protect Sheet as the switch that enforces it.

Cell setting Sheet not protected Sheet protected
Locked (the default) Anyone can edit Can’t be edited
Unlocked Anyone can edit Can still be edited
Locked + Hidden Anyone can edit and see formulas Can’t be edited, and the formula doesn’t show in the formula bar

Two other kinds of protection sound similar but do different jobs. Protect Workbook stops people from adding, deleting, renaming, hiding or moving sheets, but it doesn’t lock any cells. Encrypt with Password (under File > Info > Protect Workbook) stops people from opening the file at all. Locking cells is about the first one: letting people open and use a sheet while keeping certain cells safe from changes. A third option, signing a workbook with a signature line, makes the whole file read-only once someone signs it.

A worked example makes this clearer. Say you have a simple budget where people should type amounts in column B, but the total in B6 and the labels in column A should stay put:

Advertisements
A B
1 Expense Amount
2 Rent 1,400
3 Groceries 450
4 Utilities 180
5 Transport 220
6 Total =SUM(B2:B5)

The goal is to leave B2:B5 editable and lock everything else. The steps below use this layout.

Lock only specific cells (Windows)

If the sheet is already protected, go to Review > Unprotect Sheet first and enter the password if asked. You can’t change Locked settings on a protected sheet.

  1. Select the whole sheet. Click the triangle in the top-left corner where the row numbers meet the column letters, or press Ctrl+A (press it twice if your cursor is inside a block of data).
  2. Open Format Cells. Press Ctrl+1, or right-click any selected cell and choose Format Cells.
  3. Unlock everything. Click the Protection tab, clear the Locked check box, and click OK. Nothing changes on screen, but every cell is now unlocked.
  4. Select the cells you want to protect. In the example, drag over A1:A6, then hold Ctrl and click B1 and B6. Holding Ctrl lets you add ranges that aren’t next to each other.
  5. Lock them. Press Ctrl+1 again, go to Protection, tick Locked, and click OK. You can also use Home > Format > Lock Cell, which toggles the same setting. To hide the formula as well, tick Hidden in the same tab.
  6. Protect the sheet. Go to Review > Protect Sheet. You can also right-click the sheet tab at the bottom of the window and choose Protect Sheet.
  7. Set what’s allowed. In the Protect Sheet dialog, keep Protect worksheet and contents of locked cells ticked. In the Allow all users of this worksheet to list, leave Select locked cells and Select unlocked cells ticked, and tick anything else people need (the next section explains each option).
  8. Add a password (optional). Type one in Password to unprotect sheet. Without a password, anyone can click Unprotect Sheet and undo your work. With one, write it down somewhere safe first, because Microsoft can’t recover a forgotten sheet password.
  9. Click OK. If you entered a password, Excel asks you to type it again in the Confirm Password box. Click OK.
  10. Test it. Type in B3: it should accept the change. Then try to type in B6 or A2. Excel shows a message saying the cell is on a protected sheet and that you need to unprotect it to make a change. The Protect Sheet button now reads Unprotect Sheet.

There’s a shortcut when only a few cells need to stay editable: skip steps 1 to 5, select just the input cells (B2:B5 in the example), press Ctrl+1, clear Locked, and protect the sheet. Everything you didn’t touch is still locked by default, so you end up with the same result in fewer clicks.

Protection applies to one sheet at a time. If your workbook has several tabs, protect each one you want locked.

Lock only the cells with formulas

On a large sheet, picking out every formula by hand is slow. Excel can select them all at once.

  1. Select the whole sheet, press Ctrl+1, clear Locked on the Protection tab, and click OK.
  2. Go to Home > Find & Select > Go To Special. (Pressing F5 or Ctrl+G and clicking Special opens the same box.)
  3. Choose Formulas, leave the four types under it ticked, and click OK. Excel selects every cell that contains a formula.
  4. Press Ctrl+1, tick Locked (and Hidden if you don’t want the formulas visible), and click OK.
  5. Go to Review > Protect Sheet, choose your options and password, and click OK.

Every typed-in value stays editable, and every formula is protected. If you add new formulas later, they’ll be unlocked unless you repeat these steps, because cells inherit the unlocked setting you applied in step 1.

Choose what people can still do

The checklist in the Protect Sheet dialog controls what everyone can do on the protected sheet. Ticking an option allows it; clearing it blocks it. These are the ones most people care about:

Option What happens if you tick it
Select locked cells People can click on locked cells (they still can’t change them). Clear it to make locked cells unselectable, so pressing Tab jumps only between input cells.
Select unlocked cells People can click on and type in unlocked cells. Leave this on, or no one can use the sheet.
Format cells / columns / rows People can change formatting, column widths and row heights, including on locked cells.
Insert rows / columns People can add rows or columns.
Delete rows / columns People can delete rows or columns. If you allow inserting but not deleting, people can add rows they can’t remove again.
Sort People can sort, but only ranges that contain no locked cells.
Use AutoFilter People can use filter arrows that already exist. They still can’t turn filters on or off while the sheet is protected, so add filters before protecting.
Use PivotTable & PivotChart (Use PivotTable reports in some versions) People can rearrange and filter pivot tables on the sheet.
Edit objects People can change charts, shapes and text boxes, and add or edit comments.

Let certain people edit certain ranges

On Windows, Allow Edit Ranges lets you give a range its own password, so a manager can edit the rates column while everyone else can only fill in hours. Set this up while the sheet is still unprotected; the button is greyed out on a protected sheet.

  1. Go to Review > Allow Edit Ranges.
  2. In the Allow Users to Edit Ranges box, click New.
  3. Type a Title such as Rates, and in Refers to cells, select the range (for example =$C$2:$C$20).
  4. Enter a Range password and click OK, then confirm it.
  5. Click Protect Sheet at the bottom of the box and finish protection as usual, with its own sheet password.

When someone tries to edit that range, Excel asks for the range password. Everything else stays locked. On a company network, the Permissions button in the New Range box can let named Windows domain accounts edit the range without a password.

Locking cells on a Mac or in Excel for the web

Excel for Mac

The method is the same; only the shortcuts change.

  1. Select the whole sheet (Command+A), press Command+1 to open Format Cells, and clear Locked on the Protection tab.
  2. Select the cells to protect, press Command+1, and tick Locked.
  3. Go to Review > Protect Sheet, choose what users may do, add an optional password, and click OK.

You can also reach Format Cells from the menu bar with Format > Cells.

Excel for the web

Protection you set in desktop Excel is kept when the file is opened in a browser, so the most reliable route is to lock the cells in the desktop app and then upload or share the file. Microsoft 365 users may also see Review > Manage Protection in Excel for the web, which opens a pane on the right where you can switch sheet protection on, list ranges that stay unlocked, and set a password. The options there are fewer than in the desktop dialog, and the pane isn’t available in every account, so if you don’t see it, use the desktop app.

Unlock cells and remove protection

  • To turn protection off: go to Review > Unprotect Sheet, or right-click the sheet tab and choose Unprotect Sheet. Enter the password if there is one. Your Locked settings stay in place, so protecting again later restores the same setup.
  • To make a locked cell editable permanently: unprotect the sheet, select the cell, press Ctrl+1, clear Locked, and protect the sheet again.
  • To check whether a sheet is protected: look at the Review tab. If the button says Unprotect Sheet, protection is on.

If locking isn’t working

  • You can still type in cells you locked. The sheet isn’t protected yet, or you protected a different tab. Go to Review > Protect Sheet on the sheet that holds the cells.
  • Every cell is locked, including the ones people should fill in. All cells start out Locked. Unprotect the sheet, select the input cells, press Ctrl+1, clear Locked, and protect again.
  • Protect Sheet or Format Cells is greyed out. You may be in the middle of editing a cell (press Enter or Esc), the file may be open read-only or in Protected View (click Enable Editing), or the workbook may use the legacy Shared Workbook feature, which has to be turned off first.
  • Allow Edit Ranges is greyed out. The sheet is already protected. Unprotect it, set up the ranges, then protect it again.
  • People can’t sort or filter. Sorting is blocked on any range containing locked cells, even if Sort is ticked. Filters must be turned on before you protect the sheet, and Use AutoFilter must be ticked.
  • You forgot the password. Microsoft can’t retrieve it. If the file lives in OneDrive or SharePoint, open Version History and restore a copy from before protection was added, or go back to a backup.

One warning before you rely on this: sheet protection is meant to prevent accidental changes, not to keep data secret. It’s not strong security, and anyone who can open the file can still see unlocked and locked values. For confidential data, encrypt the whole file with a password and limit who receives it.

Common questions about locked cells

Can I lock cells without protecting the sheet?

No. Locking only takes effect when sheet protection is on. You can, however, protect a sheet in a way that feels open: unlock most cells and leave only formulas locked, and people won’t notice the protection unless they try to change a formula.

How do I lock cells but still allow data entry?

Unlock the input cells before protecting the sheet. With Select unlocked cells ticked in the Protect Sheet dialog, people can type into those cells freely while everything else stays fixed.

How do I hide a formula so people can’t see it?

Select the formula cells, press Ctrl+1, tick Hidden on the Protection tab, and protect the sheet. The result still shows in the cell, but the formula bar stays blank when someone selects it.

Is locking cells the same as freezing them?

No. Freezing (View > Freeze Panes) keeps rows or columns on screen while you scroll, as covered in how to freeze panes in Excel. It has nothing to do with editing. Locking stops changes.

What does the $ sign do? I thought that locked a cell.

The dollar sign in a reference like $B$6 is an absolute reference. It “locks” the reference so it doesn’t shift when you copy the formula, but it doesn’t stop anyone editing the cell. Press F4 while editing a reference to cycle through $B$6, B$6, $B6 and B6.

Does protection carry over when I send the file?

Yes. The Locked settings and sheet protection are saved in the workbook and apply for anyone who opens it in Excel on Windows, Mac or the web.

Before you share the sheet

Test it as the other person would: try to type in a locked cell, a few input cells, and use Tab to move around. Light shading on the input cells helps people see where they’re allowed to type. If you also share Word documents that need the same kind of protection, the steps for restricting editing in Word work on a similar idea, and you can lock specific text in Word while leaving form fields open.

Microsoft’s full list of Protect Sheet options, including chart sheets and user permissions, is on its page about how to lock or unlock specific areas of a protected worksheet, and its guide to protecting a worksheet covers the unprotect steps and password warnings.

Advertisements