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: Highlighting Values in a Cell.

Highlighting Values in a Cell

by Allen Wyatt
(last updated October 18, 2014)


Trev has a table of sales forecasts by product that several users review and update. The forecasts are initially set with various formulas, but the users are allowed to override the formulas by entering a value into any cell that contains one of the formulas. If a user does this, it would be helpful for Trev to have Excel somehow highlight that cell. There are a couple of approaches you can take. First, you could use conditional formatting to do the highlighting. Set the conditional formatting rule type to Format Only Cells that Contain, "Cell Value" "Not Equal To," and then enter the formula as the comparison. This will tell you when the value in the cell does not equal whatever the formula is, but a potential "gottcha" is if the person overrides the formula with the result of that formula. For instance, if the formula would have produced a result of "27" and the user types "27" into the cell. Another possibility is to define a formula in a named constant and then use that named constant in a conditional format. Follow these steps:
  1. Display the Formulas tab of the ribbon.
  2. Click Define name in the Defined Names group. Excel displays the New Name dialog box. (See Figure 1.)
  3. Figure 1. The New Name dialog box.

  4. In the Name box, enter the name you want assigned to this formula. For this example, use CellHasNoFormula.
  5. Select whatever is in the Refers To box, at the bottom of the dialog box, and press Del. This gets rid of whatever Excel had there before.
  6. Enter the following formula in the Refers To box:
  7.      =NOT(GET.CELL(48,INDIRECT("rc",FALSE)))
  8. Click OK.
Now you can set up some conditional formats and use this named formula in the format. Simply set the conditional formatting rule type to Use a Formula to Determine which Cells to Format and enter the following formula in the condition:
The formula returns True or False, depending on whether there is a formula in the cell or nor. If there is no formula, then True is returned and whatever format you specify is applied to the cell. Another approach is to use a user-defined function to return True or False, and then set up the conditional format. You could use a very simple macro, such as the following:
Function IsFormula(Check_Cell As Range) As Boolean
    IsFormula = Check_Cell.HasFormula
End Function
You can then specify the conditional formatting rule type as Use a Formula to Determine which Cells to Format and enter the following formula in the condition if, for instance, you are conditionally formatting cell C1:
The formula returns True if there is no formula in the cell, so the conditional format is applied. The only downside of using any of these formulas to determine if a formula is in the cell is that it cannot determine if the formula in the cell has been replaced with a different formula. This applies to both the macro approach and the defined formula approach. A totally different approach is to rethink your worksheet a bit. You can separate cells for user input from those that use the formulas. The formula could use an IF function to see if the user entered something in the user input cell. If not, your formula would be used to determine a value; if so, then the user's input is used in preference to your formula. This approach allows you to keep the formulas you need, without them being overwritten by the user. This results in great integrity of the formulas and the worksheet results.


If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

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

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


Turning Off Automatic Captioning

Word can be configured so that it automatically adds captions to some of your design elements (tables, figures, etc.). ...

Discover More

Transposing Two Paragraphs

Need to swap two adjacent paragraphs? Your editing arsenal can include a command to do this if you use the macro in this tip.

Discover More

Word 2016 Graphics (Table of Contents)

One way to enhance your documents is with Word's powerful graphics capabilities. Discover how to best utilize graphics ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (ribbon)

Wrapping Text in Merged Cells

When you are formatting your worksheet, Excel lets you easily merge adjacent cells together. If you want to wrap the text ...

Discover More

Adjusting Cell Margins for More White Space

Is the information in your cells too jammed up? Here are some ways you can add some white space around that information ...

Discover More

Select One Cell and Make Another Cell Bold

Excel provides a number of different ways you can apply formatting to a cell based upon various dynamic conditions. One ...

Discover More

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

View most recent newsletter.


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 five more than 8?

2014-10-22 09:47:46

Bigger Don


I had never seen Get.Cell before, nor had I seen using "rc" for current cell in an Indirect().

A little research shows Get.Cell is a holdover from Excel4 Macros. There are references on-line that will tell you what other constants give different results. Just search for "Get.Cell".

To get the value of the cell use "5". Warning on that is it returns "0" when the cell is blank, similar to what happens with VLOOKUP().

Oddly, "Get.Cell" cannot be used in a cell formula nor can I find a way to use it in VBA code. The only place I can see an ability to use it is in a Name. It looks like that is why Allen put it into the Name before using it in a Conditional Format formula.

As to using the "rc" in the Indirect(), I did a little experimentation with that.
* "rc" does return the current cell
* Putting a number after "r" or "c" uses the absolute row or column number. So if you wanted to look in Column A of the same row it would read "rc1".
* Putting that number in square brackets, i.e. "[]", gives the relative address. If you wanted to compare the value of the Column A in the current row with Column A of the previous row then the formula would be "=Indirect("rc1",False)=Indirect("r[-1]c1",False)" without the quotes. (I use this type of comparison to set the font color equal to the background color when there is redundant information. It makes spreadsheets much more readable as reports.)

2014-10-20 06:27:00


Excel will also treat a cell entry of "=27" (without the parentheses) as a formula because of the equals sign.

2014-10-19 23:49:28

Andy R

Thanks for the tip. I have been scratching my head to understand exactly how this works as I think it could have many uses.


Can you confirm:
1 - How you know that "48" means a Constant?

2 - I assume since you chose the "not" path, there isn't a variable that tells you the value in the cell is a formula?

This is the first time I've seen "rc" as part of an Indirect. It got me thinking about its use irrespective of the use above.

3 - I assume this essentially means "current cell"?

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

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.