Function Problems

How to Highlight Only the First Duplicate in WPS Spreadsheet Using Conditional Formatting

Ayan MasoodAyan Masood Nov 13, 2026 869 views

Question details

The user needs to highlight only the first occurrence of duplicate values in a selected WPS Spreadsheet range using a formula-based conditional formatting rule.

Product
WPS Spreadsheet
Device & OS
not provided
Scenario
The user has a range such as A2:A500 containing repeated values and wants to identify the first occurrence of each value without adding a helper column.
Observed behavior
The desired result is that only the first occurrence of each repeated value in the range is highlighted; later duplicate occurrences remain unhighlighted.
Before you start

Select the exact range to format, for example A2:A500, and confirm which cell is active because the formula uses the active cell reference. Avoid merged cells inside the range so the rule is applied consistently.

Solution 1Recommended

Create a formula-based rule to highlight only the first duplicate

Use this solution when your values are in a fixed range such as A2:A500 and you want only the first duplicate occurrence to be highlighted.

The first COUNTIF checks whether a value appears more than once in the whole range. The second COUNTIF expands only down to the current row, so the rule triggers only for the first occurrence of each repeated value.

1
Select the data range

Select cells A2:A500. Ensure A2 is the active cell in the selection.

2
Open Conditional Formatting New Rule

Go to Home > Conditional Formatting > New Rule.

3
Choose a formula-based rule

In the New Formatting Rule dialog, select Use a formula to determine which cells to format.

4
Enter the COUNTIF formula

Enter =AND(COUNTIF(A$2:A$500,A2)>1,COUNTIF(A$2:A2,A2)=1) in the formula box.

5
Apply the desired highlight

Click Format, choose a fill or font style, then click OK to save the rule and return to the worksheet.

First duplicate highlighted: The rule formats only the first occurrence of each value that appears more than once. If your data grows, update the Applies to range manually because conditional formatting rules do not resize it automatically.

Highlight Only the First Duplicate in WPS Spreadsheet

WPS Spreadsheet supports formula-based conditional formatting, so you can create a COUNTIF rule that highlights only the first duplicate in a selected range without adding helper columns.

  1. 1. Select your data range: Open WPS Spreadsheet and select the range such as A2:A500, making A2 the active cell.
  2. 2. Create a new conditional formatting rule: Click Home > Conditional Formatting > New Rule.
  3. 3. Enter the first-duplicate formula: Choose Use a formula to determine which cells to format and enter =AND(COUNTIF(A$2:A$500,A2)>1,COUNTIF(A$2:A2,A2)=1).
  4. 4. Choose a highlight format: Click Format, pick a fill color or font style, and click OK.
  5. 5. Apply and review: Click OK again to apply the rule and confirm only the first duplicate in each group is highlighted.
Highlights only the first duplicate using familiar COUNTIF conditional formattingNo helper columns required in your worksheetFull compatibility with Microsoft Excel XLSX formulas and formattingFree WPS Office Suite includes WPS Spreadsheet, Writer, and Presentation
microsoft office alternative - wps office

Frequently Asked Questions

Why does the formula use A$2:A$500 and A$2:A2?

A$2:A$500 locks the entire search range and checks whether a value repeats anywhere in the range. A$2:A2 expands relative to the active row, so it only counts up to the current row and ensures the first occurrence is highlighted.

Can I use a structured table reference inside the conditional formatting formula?

No. Conditional formatting formulas do not support structured table-reference syntax in this context. Use standard references such as A2, and manually update the Applies to range after the table size changes.

How do I change the highlight color later?

Select the same range, go to Home > Conditional Formatting > Manage Rules, choose the rule, then click Edit Rule and Format to change the fill or font style.

What should I do if my data range grows after applying the rule?

Open Home > Conditional Formatting > Manage Rules and update the Applies to range to include the new rows, because conditional formatting ranges do not resize automatically.