This blog article is one out of two articles on the same subject.
Highlight duplicates where adjacent cell value meets criteria using conditional formatting in excel
Highlight duplicates where adjacent cell value meets criteria using conditional formatting in excel part 2

Question: How do I only highlight duplicates that occur for the second time or more in a list (Column B) and where an adjacent cell value (Column A) must meet a criteria? See picture below.

highlight-duplicates

Answer: Here is the conditional formatting formula: =IF((COUNT(IF(($B$2:$B2=$B2)*($A$2:$A2=$E$1), 1, ""))>1)*($A2=$E$1), TRUE, FALSE)

highlight-duplicates2

How to apply the conditional formatting formula in excel 2007:

  1. Select the range (A2:B16)
  2. Click "Home" tab on the ribbon
  3. Click "Conditional formatting"
  4. Click "New rule..."
  5. Click "Use a formula to determine which cells to format"
  6. Click "Format values where this formual is true" window.
  7. Type =IF((COUNT(IF(($B$2:$B2=$B2)*($A$2:$A2=$E$1), 1, ""))>1)*($A2=$E$1), TRUE, FALSE)
  8. Click Format button
  9. Click "Fill" tab
  10. Select a color
  11. Click OK!
  12. Click OK!

Change the category (E1) and see how different cells being highlighted.

Download excel example file.
highlight-duplicates-where-adjacent-column-meets-criteria-using-conditional-formatting.xls

(Excel 97-2003 Workbook *.xls)

Functions in this article:

IF(logical_test;[value_if:true];[value_if_false])
Checks whether a condition is met, and returns one value if TRUE, and another value if FALSE

COUNT(value1;[value2])
Counts the number of cells in a range that contain numbers

Related posts:

Highlight duplicates where adjacent cell value meets criteria using conditional formatting in excel part 2

Highlight duplicates where an adjacent column is in a date interval using conditional formatting in excel

Highlight duplicates using conditional formatting in excel

Highlight the second or more duplicates in two lists using conditional formatting in excel

Create a list of duplicates where adjacent cell value meets a condition in excel