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...

Regulatory compliance, risk management and cost-cutting are the big heartburn issues for finance execs in the C-suite. Yet financial planning and analysis—a key antacid—is insufficient.That's just one of the...
Continuing its efforts to simplify accounting procedures, the FASB has issued a proposed Accounting Standards Update on customer fees paid in a cloud computing arrangement. The newly-proposed update (Intangibles—...
How are you planning? What tools do you use (or fail to use) for forecasting? PlanGuru is a business budgeting, forecasting, and performance review software company based in White Plains, N.Y. AccountingWEB recently spoke...

Already a member? log in here.

Upcoming CPE Webinars

Aug 28
Excel spreadsheets are often akin to the American Wild West, where users can input anything they want into any worksheet cell. Excel's Data Validation feature allows you to restrict user inputs to selected choices, but there are many nuances to the feature that often trip users up.
Sep 9
In this session we'll discuss the types of technologies and their uses in a small accounting firm office.
Sep 11
This webcast will include discussions of commonly-applicable Clarified Auditing Standards for audits of non-public, non-governmental entities.
Sep 26
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.