Apply Conditional Formatting If Data in More Than 1 Cell Matches

M

Maureen

I have 2 cells that contain data. The data in both these cells will be
compared against one another.

If the data between the 2 cells MATCH, then turn both cells green.
If the data between the 2 cells DIFFER, then turn both cells red.

For example:

If cell L14 matches cell F14, then turn F14 green
If cell L14 does not match cell F14, then turn F14 red

Do I need to use an "IF" statement combined with conditional formatting to
achieve this?

What would the formula look like?
 
T

T. Valko

You're description doesn't match.

* added for emphasis.
If the... 2 cells MATCH, then turn *both* cells green.
If the... 2 cells DIFFER, then turn *both* cells red.
If cell L14 matches cell F14, then turn *F14* green
If cell L14 does not match cell F14, then turn *F14* red
 
M

Maureen

Let me clarify:
If the 2 cells match, I want both cells to turn green
If the 2 cells do not math, I want both cells to turn red

Updated example:
If L14 matches F14; turn L14 and F14 green.
If L14 does not match F14; turn L14 and F14 red.

I am not sure how to write the formula to apply the conditional formatting.
 
T

T. Valko

Try this...

I don't know if need you to take empty/blank cells into account. If both
cells are empty/blank they will match. So, I'll write the formulas to
account for empty/blank cells. This means no format will be applied unless
both cells contain some entry.

Select cells F14 and L14
Goto the menu Format>Conditional Formatting
Condition 1 = GREEN
Select the Formula Is option
=AND($F14<>"",$L14<>"",$F14=$L14)
Click the Format button
Select the Patterns tab
Select a nice shade of GREEN
OK
Click the Add button
Condition 2 = RED
Select the Formula Is option
=AND($F14<>"",$L14<>"",$F14<>$L14)
Click the Format button
Select the Patterns tab
Select a nice shade of RED
OK out
 
M

Maureen

That worked great!
Thanks

T. Valko said:
Try this...

I don't know if need you to take empty/blank cells into account. If both
cells are empty/blank they will match. So, I'll write the formulas to
account for empty/blank cells. This means no format will be applied unless
both cells contain some entry.

Select cells F14 and L14
Goto the menu Format>Conditional Formatting
Condition 1 = GREEN
Select the Formula Is option
=AND($F14<>"",$L14<>"",$F14=$L14)
Click the Format button
Select the Patterns tab
Select a nice shade of GREEN
OK
Click the Add button
Condition 2 = RED
Select the Formula Is option
=AND($F14<>"",$L14<>"",$F14<>$L14)
Click the Format button
Select the Patterns tab
Select a nice shade of RED
OK out
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top