Highlight Rows with Multiple Column B Values in Excel
Question details
Identify column A values associated with more than one distinct value in column B and highlight all corresponding rows.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet contains related values in columns A and B, and the user wants to find inconsistent associations.
- Observed behavior
- Rows should be highlighted when their column A value is linked to at least two different nonblank column B values.
The steps assume headers in row 1, data in rows 2 through 1000, and an empty helper column C. If your data extends beyond row 1000, change every 1000 in the formulas and selection to your last data row.
Use a Helper Column and Conditional Formatting in Excel
Highlight every row for a column A value that has multiple distinct, nonblank column B values.
The helper column finds the first nonblank B value for each A value. The formatting rule then checks whether a different nonblank B value exists for the same A value.
Repeated copies of the same B value do not count as different values. Blank B cells are ignored when identifying conflicts, but their rows are highlighted if their A value has a conflict elsewhere.
In cell C2, enter =IF($A2="","",IFERROR(INDEX($B$2:$B$1000,MATCH(1,INDEX(($A$2:$A$1000=$A2)*($B$2:$B$1000<>""),0),0)),"")) and fill it down through C1000.
Select A2:B1000. Keep A2 as the active cell so the rule's relative references start on row 2.
Go to Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format. Enter =AND($A2<>"",SUMPRODUCT(--($A$2:$A$1000=$A2),--($B$2:$B$1000<>""),--($B$2:$B$1000<>$C2))>0).
Select Format, choose a fill color, and click OK. Confirm the rule applies to =$A$2:$B$1000.

Highlight Conflicting Column Values in WPS Spreadsheet
Use a helper formula and a conditional-formatting rule in WPS Spreadsheet to highlight rows whose column A value has multiple distinct column B values.
- 1. Open the spreadsheet: Open your workbook in WPS Spreadsheet and confirm that column C is empty and row 1 contains headers.
- 2. Fill the helper column: In C2, enter =IF($A2="","",IFERROR(INDEX($B$2:$B$1000,MATCH(1,INDEX(($A$2:$A$1000=$A2)*($B$2:$B$1000<>""),0),0)),"")) and fill it down through C1000.
- 3. Add a conditional-formatting rule: Select A2:B1000, then choose Home > Conditional Formatting > New Rule and select the option to use a formula. Enter =AND($A2<>"",SUMPRODUCT(--($A$2:$A$1000=$A2),--($B$2:$B$1000<>""),--($B$2:$B$1000<>$C2))>0).
- 4. Apply the highlight: Choose a fill color in the rule's formatting options and confirm the rule. Save the workbook using File > Save.

Frequently Asked Questions
Will repeated identical values in column B be highlighted?
No. The rule highlights rows only when the same column A value has at least two different nonblank B values.
Are blank column B cells treated as a separate value?
No. Blank B cells are excluded from the comparison. However, a row with a blank B cell is highlighted if its A value has conflicting nonblank B values on other rows.
How do I include more than 1,000 rows?
Replace 1000 with your last data row in both formulas, fill the helper formula to that row, and update the conditional-formatting Applies To range to match.
Can I highlight additional columns in each affected row?
Yes. In Home > Conditional Formatting > Manage Rules, extend the Applies To range, for example from =$A$2:$B$1000 to =$A$2:$D$1000. Keep the formula references to columns A, B, and C unchanged.




