Formatting Issues

Highlight Duplicate Values Except X in Each Excel Row

Kushani NimanthikaKushani Nimanthika Nov 20, 2026 869 views

Question details

Highlight duplicate values within each date row while excluding a specific value such as X.

Highlight Duplicate Values Except X in Each Excel Row
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.
Before you start

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.

Solution 1Recommended

Create a Formula-Based Conditional Formatting Rule

Use a formula to check each row for duplicates while ignoring X.

1
Select the data range

In Excel, select the cells to check, such as B2:H100. Start the selection at B2 so the formula matches the top-left cell.

2
Create a rule

On the Home tab, select Conditional Formatting > New Rule, then choose Use a formula to determine which cells to format.

3
Enter the formula

In the formula box, enter =AND(B2<>"X",COUNTIF($B2:$H2,B2)>1).

4
Choose the highlight

Select Format, choose a fill color, and select OK to save the format and the rule.

Create a Formula-Based Conditional Formatting Rule
Adjust the range if needed: The dollar signs keep the check within columns B through H, while the row number changes for each row. If your data starts in a different cell or spans different columns, update the formula and selected range to match.
Work with spreadsheets

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. 1. Open the worksheet: Open WPS Spreadsheets and select File > Open to load your workbook.
  2. 2. Select the cells: Select the data range, such as B2:H100, starting with the top-left cell B2.
  3. 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. 4. Set the format: Choose a fill color in the rule's formatting options and confirm the rule to highlight matching cells.
Check duplicates separately in each date rowExclude a specific value from highlightingOpen and edit Microsoft Excel XLSX and XLS filesUse a familiar spreadsheet interface
microsoft office alternative - wps office

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.