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: Conditional formatting formula:

=IF($A2=$E$1,COUNTIFS($A$2:$A$16,$E$1,$B$2:$B$16,$B2),0)

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($A2=$E$1,COUNTIFS($A$2:$A$16,$E$1,$B$2:$B$16,$B2),0)
  8. Click Format button
  9. Click "Fill" tab
  10. Pick 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-formattingv2.xlsx
(Excel 97-2003 Workbook *.xls)

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

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

COUNTIFS(criteria_range1,criteria1, criteria_range2, criteria2...)
Counts the number of cells specified by a given set of conditions or criteria