Highlight cells that equal

An excel formula to highlight cells that equal

Related Functions

Sponsored Link

 Highlight cells that equal
=A1="X"

Note: Excel contains many built-in "presets" for highlighting values with conditional formatting, including a preset to highlight cells that contain equal a specific value. However, if you want more flexibility, you can use your own formula, as explained in this article.

If you want to highlight cells that equal text, you can use a simple formula that returns TRUE when a cell contains the text (substring) that you specify.

For example, if you want to highlight any cells in the range C5_C11 that contain the text "dog", you can use:

 
=C5="Dog"

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

In the example we have pulled the value we are looking for out on to the worksheet in cell F6, so it can be easily changed. The conditional formatting rule itself is using this formula:

 
=C5=$F$6

How this formula works

This formula is just a simple comparison using the equal to operator (=).

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 7 cells in C5:C11, and during evaluation C5 will change to the address of the cell being evaluated in the range where conditional formatting is applied.

The address of the cell that contains the search string (F6) is an absolute reference ($F$6) so that it is "locked" and won't change as the formula is evaluated.

Case sensitive option

By default a comparison is not case-sensitive. If you need to check case as well, you can use the EXACT function instead of the equals.

 
=EXACT(C5,$F$6)

 

Sponsored Link

0 votes. 0 / 5