Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Conditionally Highlighting Cells Containing Formulas.

Conditionally Highlighting Cells Containing Formulas

by Allen Wyatt
(last updated November 8, 2014)

8

You probably already know that you can select all the cells containing formulas in a worksheet by pressing F5 and choosing Special | Formulas. If you need to keep a constant eye on where formulas are located, then repeatedly doing the selecting can get tedious. A better solution is to use the conditional formatting capabilities of Excel to highlight cells with formulas.

Before you can use conditional formatting, however, you need to create a user-defined function that will return True or False, depending on whether there is a formula in a cell. The following macro will do the task very nicely:

Function HasFormula(rCell As Range) As Boolean
    Application.Volatile
    HasFormula = rCell.HasFormula
End Function

To use this with conditional formatting, select the cells you want checked, and then follow these steps:

  1. With the Home tab of the ribbon displayed, click the Conditional Formatting option in the Styles group. Excel displays a palette of options related to conditional formatting.
  2. Choose New Rule. Excel displays the New Formatting Rule dialog box.
  3. In the Select a Rule Type area at the top of the dialog box, choose Use a Formula to Determine Which Cells to Format. (See Figure 1.)
  4. Figure 1. The New Formatting Rule dialog box.

  5. In the Format Values Where This Formula Is True box, enter "=HasFormula(A1)" (without the quote marks). If the active cell in the range that you selected is not A1, you'll need to modify the formula slightly to reflect whatever cell is active.
  6. Click Format to display the Format Cells dialog box.
  7. Use the controls in the Format Cells dialog box to specify how you want the cells formatted.
  8. Click OK to close the Format Cells dialog box.
  9. Click OK.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9900) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Conditionally Highlighting Cells Containing Formulas.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Median of Selected Numbers

Need to find a median value in a series of values? It's easy with the MEDIAN function. What isn't as easy is to derive the ...

Discover More

Word Mail Merge Magic (Special Offer)

Word Mail Merge Magic makes a great addition to the library of anyone wanting to master using Word's mail merge tool. ...

Discover More

Setting an Alarm

By using the alarm capabilities of Windows, you can make sure you never miss another important time again. This tip shows you ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (ribbon)

Detecting Errors in Conditional Formatting Formulas

If an error exists in a formula tucked inside a conditional format, you may never know it is there. There are ways to find ...

Discover More

Automatic Lines for Dividing Lists

When preparing a report for others to use, it is not unusual to add a horizontal line between major sections of the report. ...

Discover More

Alerts About Approaching Due Dates

You may use Excel to track due dates for a variety of purposes. As a due date approaches, you may want that fact drawn to ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is four less than 9?

2016-06-21 07:39:04

Willy Vanhaelen

If you have an Excel version prior to 2013 you can do it without a user defined function as well.
See: http://spreadsheetpage.com/index.php/tip/identify_formulas_by_using_conditional_formatting/


2016-06-21 02:25:52

Peter Watson

apparently "isformula" is new in Excel 2013


2016-06-21 02:23:44

Peter Watson

think there's an easier way - one that does not use a macro - you can use the excel formula-function "isformula".
refer http://www.contextures.com/excelisformulafunction.html
for how

worked for me


2016-01-29 09:51:32

Marti Jordan

I think I was confused because of the title. This doesn't mean it will conditionally format any cell with any formula. I believe this will identify only the cells with a specific formula. Am I correct?

I'd like to conditionally format a sheet in my workbook to highlight any cell that contains any formula.


2016-01-29 09:27:38

Marti Jordan

I've tried it multiple times to multiple cells, single cells... nothing is highlighted.


2015-03-18 12:23:01

Matt W

Using Application.Volatile here means all this conditional formatting will be recalculated whenever any cell on the sheet changes.

This can cause slowness, and I even managed to cause some sort of bizarre interactions with editing the text on form controls.

I suggest using this function minus the Application.Volatile line, it seems to work just as well without it (in Excel 2013).


2015-02-07 11:36:11

Willy Vanhaelen

You can do it without a user defined funtion. See: http://j-walk.com/ss/excel/usertips/tip045.htm


2015-02-06 18:21:43

Mark M

Gave it a red hot try but does not seem to work for Excel 365


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.