Excel Tip: Use Conditional Formatting to Identify Unlocked Cells

By David Ringstrom, CPA

In a previous article, I described a technique that lets you tell at a glance if an individual cell is unlocked within a worksheet. In this article, I'll demonstrate how you can use conditional formatting to identify all unlocked cells within a worksheet range. This can serve both as an input aid, so that users know which cells they can affect, as well as an auditing tool, so that you know which cells are protected and which aren't.
We'll use the CELL function within Conditional Formatting to color unlocked cells. The CELL function provides information about worksheet cells, and takes this form:
The info_type argument signifies the type of information that we'd like to return about the cell. A couple of available info types include:
  • protect – returns 0 if a cell is unlocked, or 1 if it is locked.
  • filename – returns the workbook's file name.
  • type – returns b if a cell is blank, l (lowercase L) if the cell contains text, or v if the cell contains anything else.
Details about other info types are available in a Microsoft support article. The reference argument is an optional argument that allows us to specify a range of one or more cells. To use the CELL function in conjunction with conditional formatting:
Set up the example shown in Figure 1. To save time, type Monday in cell A2 and then drag the fill handle down to create a series of days. After you enter 100 in cell B2 and 200 in cell B3, select those two cells and double-click the Fill Handle to complete the series. In cell B9, hold down the Alt key then press and release the equal sign (=) to create an instant sum.
Figure 1: Set up the example by using time-saving shortcuts.
We now want to select just the numeric input cells, as shown in Figure 2. To do so, press Ctrl-G (or F5) to display the Go To dialog box and then click the Special button. Choose Constants, clear the checkmarks for Text, Logicals, and Errors, and then click OK.
At this point, cells B2 through B8 should be selected. Press Ctrl-1 to display the Format Cells dialog box, clear the Locked checkbox on the Protection tab, and then click OK.
Figure 2: Use the Go To Special dialog box to select the numeric constants in the example. Then, use the Format Cells dialog box to unlock the selected cells.
We now want to select the used range of our spreadsheet, as illustrated in Figure 3. To do so, click on cell A1, and then hold down the Shift key while you tap the End and then Home keys.
Access the Conditional Formatting feature:
  • Excel 2007 and later: Choose Conditional Formatting on the Home tab, New Rule, and then Use a Formula to Determine Which Cells to Format
  • Excel 2003 and earlier: Choose Format, Conditional Formatting, and then change Cell Value Is to Formula Value is.
Enter the following formula: 
Click the Format button, and choose a color from the Fill tab, and then click OK twice.
Figure 3: Use the CELL function to color the unlocked cells.
As illustrated in Figure 4, cells B2 through B8 should appear in the color that you chose. To test the feature, select cells B2 through B4, press Ctrl-1 to display the Format Cells dialog box, click Locked, and then click OK. The color should vanish from cells B2 through B4.
Figure 4: Check the Locked checkbox in the Format Cells dialog box to test your work.
You can easily remove Conditional Formatting at any time:
  • Excel 2007 and later: Choose Conditional Formatting from the Home tab, click Clear Rules, and then Clear Rules from Entire Sheet. If you want to be more selective, select a range of cells before you access the Clear Rules command and then choose Clear Rules from Selected Cells.
  • Excel 2003 and earlier: Select the range of cells with conditional formatting, choose Format, Conditional Formatting, and then click Delete. Select Condition 1 and then click OK twice.
Figure 5: Choose Clear Rules from Entire Sheet to remove the Conditional Formatting from your worksheet.
Read more articles by David Ringstrom. 
About the author:
David H. Ringstrom, CPA heads up Accounting Advisors, Inc., an Atlanta-based software and database consulting firm providing training and consulting services nationwide. Contact David at david@acctadv.com or follow him on Twitter. David speaks at conferences about Microsoft Excel, and presents webcasts for several CPE providers, including AccountingWEB partner CPE Link.


You may like these other stories...

Cybersecurity is no longer the domain of an organization's IT staff. It's moved to the boardroom, and in a big way. Accountants and financial managers may have been thinking it's just the province of the tech...
You probably don't want to think about how many times you access the File menu in Excel 2010 or 2013. Personally I think Excel 2010 has the best possible File menu arrangement, other than having Print Preview grafted...
Following other recent high-profile hacking events, investigators discovered yesterday that hackers broke into the draft work paper files of several famous CPA firms. Revealing images of the scantily clad documents have been...

Already a member? log in here.

Upcoming CPE Webinars

Sep 24
In this jam-packed presentation Excel expert David Ringstrom, CPA will give you a crash-course in creating spreadsheet-based dashboards. A dashboard condenses large amounts of data into a compact space, yet enables the end user to easily drill down into details when warranted.
Sep 30
This webcast will include discussions of important issues in SSARS No. 19 and the current status of proposed changes by the Accounting and Review Services Committee in these statements.
Oct 21
Kristen Rampe will share how to speak and write more effectively by understanding your own and your audience's communication style.
Oct 23
Amber Setter will show the value of leadership assessments as tools for individual and organizational leadership development initiatives.