How to Identify Groups with Different Values in Excel
Question details
Identify groups in column A that have inconsistent corresponding values in column B.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Data validation and cleaning to ensure that all items within a designated group have matching attributes in an adjacent column.
- Observed behavior
- Need an efficient method to flag or visually highlight rows where the same group in column A maps to varying values in column B.
Ensure your data is sorted by the grouping column (Column A) so that all identical groups appear in consecutive rows before applying sequential formula checks.
Use an IF Formula to Flag Inconsistent Values
Quickly identify inconsistencies in sorted groups by comparing the current row to the previous one using a nested IF function.
This approach is highly effective for datasets where grouped items are sorted in consecutive rows. By comparing a row with the row immediately preceding it, you can easily output a text flag when a discrepancy occurs.
Select your entire data range. Go to the Data tab and click Sort. Sort by Column A (the group column) to ensure all identical groups are consecutive.
In an empty adjacent column (e.g., cell C3), enter the formula: =IF(A3=A2,IF(B3=B2,"","Not OK"),"")
Press Enter, then click and drag the fill handle at the bottom-right corner of cell C3 down to apply the formula to the rest of the column.
Scan Column C for the "Not OK" text. This flag indicates that the group in Column A matched the previous row, but its corresponding value in Column B differed.

Apply Conditional Formatting to Highlight Differences
Visually highlight cells in Column B that do not match the expected value for their group without using extra helper columns.
Use COUNTIFS for Unsorted Data
Count occurrences of column pairs to identify groups with distinct values, useful when data cannot be sorted sequentially.
Use WPS Spreadsheet to Find Inconsistent Values Easily
WPS Spreadsheet provides powerful formula capabilities and intuitive conditional formatting to help you manage data groups and identify inconsistencies effortlessly.
- 1. Open Data: Launch WPS Spreadsheet and open your workbook containing the data groups.
- 2. Sort Groups: Select Column A, navigate to the Data tab, and click Sort to group identical items together.
- 3. Apply Formula: Enter =IF(A3=A2, IF(B3=B2, "", "Not OK"), "") in an adjacent column to automatically flag inconsistencies.
- 4. Add Highlighting: Use the Conditional Formatting feature under the Home tab to add background colors to mismatched values.

Frequently Asked Questions
Can I find inconsistent group values without sorting my data first?
Yes. You can use a combination of functions like COUNTIFS. The formula =COUNTIFS($A$2:$A$100,A2,$B$2:$B$100,B2) counts identical pairs. If an item belongs to a large group but has a low or unique count, it may indicate an inconsistency.
Why does my IF formula return an error or incorrect results?
Ensure your cell references correctly point to the current and previous rows. Also, verify that the data is sorted by the grouping column; the =IF(A3=A2,IF(B3=B2,"","Not OK"),"") formula relies on identical groups being in consecutive rows.
How do I apply conditional formatting to the whole row based on a mismatched value?
Select the entire data range instead of just one column. When creating the Conditional Formatting rule, use locked column references in your formula, such as =AND($A3=$A2, $B3<>$B2). This ensures the format is applied across the entire row when the condition is met.




