How to Highlight Duplicate IDs with Different Prices in Excel
Question details
The user needs to highlight prices in a specific column when the corresponding part number in another column appears multiple times, but the price for that part number varies.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Auditing a pricing list where identical part numbers should ideally have the same price, requiring a visual way to identify pricing discrepancies within duplicate groups.
- Observed behavior
- Prices for duplicate part numbers need to be automatically highlighted using a formula to spot variations efficiently.
Ensure your data does not contain trailing spaces or invisible characters, as these can cause the COUNTIF and COUNTIFS formulas to misinterpret duplicate text strings or numbers.
Use a Formula-Based Conditional Formatting Rule
Apply a combination of COUNTIF and COUNTIFS formulas to identify duplicate IDs that have unique prices.
This method uses the logical AND function to check two conditions simultaneously: first, whether the part number appears more than once, and second, whether the specific combination of part number and price appears exactly once.
Highlight the price range (e.g., C3:C997) where you want the formatting to appear. Note the first active row in your selection (e.g., row 3).
Navigate to the Home tab on the Excel ribbon, click 'Conditional Formatting', and select 'New Rule'.
Choose 'Use a formula to determine which cells to format'. Enter the following formula, adjusting references to match your data: =AND(COUNTIF($A$3:$A$997,$A3)>1,COUNTIFS($A$3:$A$997,$A3,$C$3:$C$997,$C3)=1).
Click the 'Format' button, select a fill color (like yellow or red) to highlight the discrepancies, and click 'OK' twice to apply the rule to your data.

Easily Highlight Complex Duplicate Data in WPS Spreadsheet
WPS Spreadsheet fully supports advanced conditional formatting formulas, allowing you to highlight complex data patterns exactly like Microsoft Excel. It is free, lightweight, and features a familiar interface.
- 1. Open your file in WPS Office: Launch WPS Spreadsheet and open the document containing your pricing data.
- 2. Select your data: Highlight the price column where you want to spot discrepancies.
- 3. Create a new formatting rule: Go to the Home tab, click 'Conditional Formatting', and choose 'New Rule'.
- 4. Apply the custom formula: Select 'Use a formula to format cells', paste your COUNTIF and COUNTIFS combination formula, set your desired highlight color, and click 'OK'.

Frequently Asked Questions
Why is my conditional formatting formula highlighting the wrong rows?
This typically happens if the active cell you selected when creating the rule doesn't match the relative reference in your formula. Ensure that if your selected range starts at row 3 (e.g., C3:C100), your formula references row 3 (e.g., $A3 and $C3).
Can I highlight the entire row instead of just the price cell?
Yes. Instead of selecting just the price column, select the entire data range (e.g., A3:C997). Use the exact same formula, making sure the column references ($A and $C) are absolute and the row numbers are relative.
How do I clear the conditional formatting rules if I make a mistake?
Go to the Home tab, click on Conditional Formatting, select Clear Rules, and choose either 'Clear Rules from Selected Cells' or 'Clear Rules from Entire Sheet' to remove the formula.




