Highlight Duplicate Values Except X in Each Excel Row
Question details
Highlight duplicate values within each date row while excluding a specific value such as X.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet has values across columns B through H for each date, and duplicates need to be identified separately in each row.
- Observed behavior
- Repeated values other than X should be highlighted within their own row.
Identify the cells to check in each date row, excluding the date column. The example below assumes the first data cell is B2 and each row runs from column B through column H.
Create a Formula-Based Conditional Formatting Rule
Use a formula to check each row for duplicates while ignoring X.
In Excel, select the cells to check, such as B2:H100. Start the selection at B2 so the formula matches the top-left cell.
On the Home tab, select Conditional Formatting > New Rule, then choose Use a formula to determine which cells to format.
In the formula box, enter =AND(B2<>"X",COUNTIF($B2:$H2,B2)>1).
Select Format, choose a fill color, and select OK to save the format and the rule.

Highlight Row Duplicates in WPS Spreadsheets
Use a formula-based conditional formatting rule in WPS Spreadsheets to highlight repeated values in each row while excluding X.
- 1. Open the worksheet: Open WPS Spreadsheets and select File > Open to load your workbook.
- 2. Select the cells: Select the data range, such as B2:H100, starting with the top-left cell B2.
- 3. Add the formula: On the Home tab, open Conditional Formatting > New Rule. Choose the formula-based rule and enter =AND(B2<>"X",COUNTIF($B2:$H2,B2)>1).
- 4. Set the format: Choose a fill color in the rule's formatting options and confirm the rule to highlight matching cells.

Frequently Asked Questions
How do I exclude a value other than X?
Replace "X" in the formula with the value you want to exclude. For example, use B2<>"N/A" to exclude N/A.
Does the formula compare values across different date rows?
No. COUNTIF($B2:$H2,B2) checks only columns B through H in the current row. The row reference changes as the rule applies to other rows.
How do I extend the rule to more columns or rows?
In Excel, open Home > Conditional Formatting > Manage Rules and update the Applies to range. If you add columns, also change $B2:$H2 in the formula to cover the new columns.
Does the rule distinguish uppercase X from lowercase x?
No. The comparison and COUNTIF are not case-sensitive, so both X and x are excluded.




