Quick, clean, and to the point

Highlight values that don't exist

Excel formula: Highlight values that don't exist
Generic formula 

If you want to highlight cells with values that don't exist in a list or table elsewhere, you can apply conditional formatting with a simple formula that uses the COUNTIF function. For example, if you want to highlight any cells in the range A1:A10 that don't exist in the range C1:C10, select A1:A10 then create a conditional formatting rule that uses this formula:


Note: with conditional formatting, it's important to enter the formula relative to the "active cell" in the selection, which is assumed to be A1 in this case.

How this formula works

When you use a formula to apply conditional formatting, the formula is evaluated relative to the active cell in the selection at the time the rule is created. In this case, the rule is evaluated for each of the 10 cells in A1:D10, and A1 will change to the address of the cell being evaluated each time. Notice that C1:C10 is entered as an absolute address, so it won't change at all.

The key to this formula is the =0 at the end, which "flips" the logic of the formula. For each value in A1:A10,  COUNTIF returns the number of times the value appears in C1:C10. As long as the value appears at least once in C1:C10, COUNTIF will return a non-zero number and the formula will return FALSE.

But when value is not found in C1:C10, the COUNTIF returns zero and, since 0 = 0, the formula will return TRUE and the conditional formatting will be applied.

Named ranges for cleaner syntax

If you name the list you are searching (C1:C10 in this case) with a named range, the formula is simpler to read and understand:


This works because named ranges are automatically absolute.

Dave Bruns

Excel Formula Training

Learn Excel formulas and functions with concise, clear videos. Master absolute/relative addresses, dates, text, named ranges, and tools for troubleshooting. Each video comes with a practice worksheet and audio transcript. Instant access and complete 100% guarantee. Start today!

See details.

Just wanted to say "Thank you" and I feel lucky I found your website! I work with contracts and your link lead me to a concise answer. No other link came close. -Karen
Excel foundational video course
Excel Pivot Table video training course
Excel conditional formatting video course
Excel formulas and functions video training course
Excel Shortcuts Video Course