Highlight Excel Duplicates While Excluding N/A Values
Question details
Create a conditional formatting rule that highlights duplicate Excel entries without highlighting cells containing N/A.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- The user wants to identify repeated entries in a range while ignoring N/A placeholders.
- Observed behavior
- Duplicate entries are highlighted, while cells containing the text N/A remain unformatted.
Identify the range to check and its first cell. The example below uses A2:A12 and treats N/A as text, not as the Excel #N/A error.
Create a formula rule to highlight duplicates except N/A
Use a conditional formatting formula to count repeated values and exclude the text N/A.
Select cells A2:A12, or select the range you want to check.
Go to Home > Conditional Formatting > New Rule, then choose Use a formula to determine which cells to format.
In the formula box, enter =AND(COUNTIF($A$2:$A$12,$A2)>1,$A2<>"N/A"). Replace $A$2:$A$12 with your selected range and $A2 with its first cell.
Click Format, choose a fill color, and click OK. Click OK again to apply the rule.

Highlight duplicates except N/A in WPS Spreadsheet
Use a formula-based conditional formatting rule in WPS Spreadsheet to highlight repeated entries while leaving text N/A placeholders unformatted.
- 1. Open the workbook: Open your Excel workbook in WPS Spreadsheet and select the range to check, such as A2:A12.
- 2. Add a rule: On the Home tab, open Conditional Formatting and choose New Rule. Select the option to use a formula.
- 3. Enter the formula: Enter =AND(COUNTIF($A$2:$A$12,$A2)>1,$A2<>"N/A") and adjust the references to match your selected range.
- 4. Apply the format: Choose a fill color in the formatting options, then confirm the rule to highlight matching duplicates.

Frequently Asked Questions
How do I change the formula for a different range?
Replace $A$2:$A$12 with the range you selected and replace $A2 with its first cell. For example, for B3:B20, use =AND(COUNTIF($B$3:$B$20,$B3)>1,$B3<>"N/A").
Does the formula exclude actual #N/A errors?
The comparison excludes the text N/A, not the #N/A error. Wrap the formula in IFERROR, as shown in the solution note, to leave cells with errors unformatted.
How can I exclude blank cells too?
Add a nonblank test to the AND formula: =AND(COUNTIF($A$2:$A$12,$A2)>1,$A2<>"N/A",$A2<>""). Enter it in the conditional formatting rule and adjust the range as needed.
Will the rule highlight every occurrence of a duplicate?
Yes. COUNTIF checks how many times each value occurs in the selected range, so every occurrence is highlighted when the count is greater than one, except for text N/A.




