Excel: Comparing a column and if the name is identical give it a red color. But if the name in another column is different leave it the normal value

StackOverflow https://stackoverflow.com/questions/18977844

  •  29-06-2022
  •  | 
  •  

Question

I'm quite new in Excel and I am trying to edit a code already in use.

My question is based on two columns: A and B (Worksheet is a symbollist)

Column A= PLC
Column B= Name.

If Column B has any cells that have the same name those rows will turn red using the following existing code(conditional formatting):

=AND($B2<>"";COUNTIF(tblSymbolList_Name;$B2)>1)

So if cell B2=name and cell B3=name than these rows will fill up with red color. Now I want to add a twist to it like this:

A2=plc1   B2=name
A3=plc2   B3=name

If this happens the rows must return to their original value(because the values in column A are different so it doesn't matter that B is the same), but somehow I can't get this done. Can any of you help me?

Regards,

Patrick

Was it helpful?

Solution

Try this formula with the conditional formatting:

=AND($B2<>"";COUNTIFS(tblSymbolList_Name;$B2;A:A;A2)>1)

I don't know all your named ranges, so replace A:A by the corresponding named range if applicable.

COUNTIFS allows you to count based on multiple criteria.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top