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

Counting Cells According to Case

Text placed in cells can either be lowercase, uppercase, or a mixture of the two. If you want to count the cells based upon ...

Discover More

Coloring Identical Company Names

Want to know where duplicates are in a list of names? There are a couple of ways you can go about identifying the duplicates, ...

Discover More

Filtering Columns

The filtering tools provided in Excel make it easy to filter a data list so that only certain rows are displayed. What if you ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (ribbon)

Conditional Formats for Odd and Even Columns

Setting up conditional formatting can be challenging under some circumstances, but once set it can work great. Unless, of ...

Discover More

Deleting Conditional Formatting

After you've applied a conditional format to a cell, you may have a need to later delete that format so that the cell is ...

Discover More

Controlling Data Entry in a Cell

Sometimes you want whatever is displayed in one cell to control what is displayed in a different cell. This tip looks at just ...

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 two less than 2?

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.