Detect and view locked and unlocked cells in Excel

While creating complex Excel based data input forms many cells needs to be protected from user input, like input labels, table titles, etc… When giving form to production I must be sure that all cells are properly locked. But, how to be sure if this having 1000+ cells ?

I discovered simple and visual technique to quickly detect and show locked and unlocked cells using Excel 2003 or 2007/2010.


Here is real life sheet scenario, 3 pages big Excel form used to capture data input and gather information. Everything must be standardized and locked to maintain data integrity, since form is used in automatic data extraction.

excel view locked unlocked cells

While developing such a form it is very easy to make a mistake and protect the wrong cell or leave cell unprotected. Usually this leads to complains from users or data in wrong cells.


I found the way to check all cells for Locked flag using “Conditional formatting”.

Recipe for excel 2007 how to view locked and unlocked cells visually

1. First select whole sheet by clicking on left upper corner

excel view locked unlocked cells

2. On the Home ribbon click “Conditional Formatting” button and click “New Rule”

excel view locked unlocked cells



3. In the window appeared choose “Use a formula to determine which cells to format”

excel view locked unlocked cells

Paste this formula:


Depedning on your windows regional settings, you may require to change “,” to “;” in this formula.

Choose format for to identify locked cells, I chose red background.

Voila! Below is same form with protected cells highlighted with red background. It very easy to check now.

excel view locked unlocked cells

After all cells have been fixed, easy to remove this rule using same method.

If you put “=0” at the end of the formula it will show not locked cells, which is very useful to highlight “entry” fields for users, a common and recommended thing to do when protecting sheets.

Another method for detecting locked and unlocked cells using Find command

You can use the Find for that.

Go to menu Edit->Find, open the Options, open the Format selection and on the protection tab mark the option locked.  With that, you can click on Find All and it will list all the locked cells on the worksheet.

The cells are locked by default, so the list may be really long.


  1. excellent trick. shame excel does not have a button that shows them like this. makes you wonder what they do all day in redmond.

  2. Thanks – this is really helpful. It also works in Excel 2003 but you must choose “Formula Is” from the dropdown, then paste the formula given above into the option box to the right.

  3. This also works with the formula =CELL(“Protect”, A1)=1 (much easier to type!). You can choose the whole sheet or just a block of cells. Must ‘Unprotect Sheet’ for the formatting to work.

  4. Excellent!! saved me lots of trouble, here is the Excel Spanish translation of the formula, just in case someone else need it.


  5. If you equal 0 (=0 at the end) instead of 1, it’ll find the opposite; unlocked cells. This is very useful to highlight “entry” fields for users, a common and recommended thing to do when protecting sheets.

  6. I keep MS Excel 2003 just for the its toolbar showing elegantly which cells are locked and which are not. When I get frustrated over the missing functionality in newer versions, I just go back to my old version. That is handy when working with large and complex spreadsheet. I do however appreciate this “workaround”.

  7. Thank you so much; I have a complex spreadsheet with multiple users and despite repeated eductaion, people are still cut/paste into the sheet, bringing with their data the formats (including locked cells). this impacts other users as they can no longer sort/copy the columns and data they need.
    this will “highlight” their entry error (and hopefully shame them into doing it correctly!)…

  8. Our accounting software allows running reports to an 2007 Excel file.
    When I do this the Windows Unhide, Ruler, Message Bar, Synch Scroll and several others are blocked. They prevented these features. I want to run macros but cannot, even after openning personal xlsb. They blocked this.

    I’ve saved book1.xls as a Trans1.xlsm that didn’t work
    I’ve openned Trans1 copied the cells containing data only, pasted this in a new Excel file as Paste Values. That didn’t work either.

    How can I get windows Unhide back?

  9. Great formula, thanks!!!

    One little tweek though: I kept getting errors when I pasted your formula and had to change the commas to semicolums. So if other people are also getting errors when trying this formula out, try to paste this one:

    =CELL(“protect”; INDIRECT(ADDRESS(ROW();COLUMN())))=1

  10. That is excellent and works perfectly. Thank you for taking the time to share this, it is much appreciated.

  11. This truly is great. I am planning to add this to one of my addins so I will have it available all the time. Of course though, the macro will have to check if the sheet is already protected and prompt to unprotect it first.

  12. Brilliant !!. One question: Why is a space needed before the INDIRECT function? (without this space it just doesn’t work)

  13. Way cool! Some very valid points! I appreciate you penning this post plus the rest of the site is really good.

  14. Worked great as a macro!…. is there a way to remove this conditional formating in a macro without disturbing any other conditional formating that might be present?

    Sub ShowLockedCells()
    Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
    “=CELL(“”protect””, INDIRECT(ADDRESS(ROW(),COLUMN())))=1″
    With Selection.FormatConditions(1).Interior
    .PatternColorIndex = xlAutomatic
    .ThemeColor = xlThemeColorAccent6
    .TintAndShade = 0.799981688894314
    End With
    Selection.FormatConditions(1).StopIfTrue = False
    End Sub

  15. This is great! And thanks to the guy who said change the 1 at the end of the formula to 0 to highlight the unlocked cells, which is what I wanted to do.

  16. Great tip! :o) Is there a similar way to display fields with hidden formulas? :o)

  17. Your formula works great, but i am trying to make it work with a checkbox. The formula i am using is: if($A$1=TRUE,(=CELL(“protect”, INDIRECT(ADDRESS(ROW(),COLUMN())))=1))
    but the result only gets applied to A2. Is there any way to apply it to the whole sheet using the checkbox? Any help is much appreciated!

  18. Changing the formula to: if($A$1,=CELL(“protect”,INDIRECT(ADDRESS(ROW(),COLUMN())))=1)) solved my problem. Thanks for getting me started anyway.

Leave a Reply

Your email address will not be published.