Formula Errors

How to Identify Groups with Different Values in Excel

Natalie TaylorNatalie Taylor Oct 22, 2026 870 views

Question details

Identify groups in column A that have inconsistent corresponding values in column B.

How to Identify Groups with Different Values in Excel
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.
Before you start

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.

Solution 1Recommended

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.

1
Sort the data

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.

2
Enter the IF formula

In an empty adjacent column (e.g., cell C3), enter the formula: =IF(A3=A2,IF(B3=B2,"","Not OK"),"")

3
Apply the formula

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.

4
Review the flags

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.

Use an IF Formula to Flag Inconsistent Values
Formula Logic: The formula =IF(A3=A2,IF(B3=B2,"","Not OK"),"") first checks if the group name matches the cell above. If true, it evaluates whether the adjacent values match. A mismatch triggers the "Not OK" warning.
Data Analysis Solution

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. 1. Open Data: Launch WPS Spreadsheet and open your workbook containing the data groups.
  2. 2. Sort Groups: Select Column A, navigate to the Data tab, and click Sort to group identical items together.
  3. 3. Apply Formula: Enter =IF(A3=A2, IF(B3=B2, "", "Not OK"), "") in an adjacent column to automatically flag inconsistencies.
  4. 4. Add Highlighting: Use the Conditional Formatting feature under the Home tab to add background colors to mismatched values.
100% compatible with Microsoft Excel formulas like IF and COUNTIFSEasy-to-use Conditional Formatting rules to highlight data errors visuallyLightweight application with fast processing for large datasets
microsoft office alternative - wps office

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.