How to Apply Conditional Formatting for Specific Duplicate Letters in Excel
Question details
The user needs to highlight specific occurrences of duplicate letters, such as only the second 'V' in a row, using conditional formatting.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Applying conditional formatting to a dataset to dynamically flag specific duplicate entries without affecting the first occurrence.
- Observed behavior
- Standard conditional formatting rules fail to differentiate between occurrences, incorrectly identifying or ignoring the targeted specific duplicate letters.
Ensure you clearly define the source range and the target formatting range, as complex array or COUNTIF formulas rely heavily on precise cell referencing.
Use Custom Formulas and Adjust Rule Priority
Use a custom formula with mixed referencing to count occurrences, and reorder the formatting rules to ensure priority.
To target specific instances of a duplicate (like the second occurrence), you cannot use the default 'Highlight Duplicate Values' feature. Instead, a custom formula combining COUNTIF, AND, or SEARCH functions evaluates the running count of each cell relative to your specified range.
Additionally, when multiple conditional formatting rules overlap, Excel applies them based on their order in the Rules Manager. Improper order will cause your specific rule to be overwritten.
Click and drag to select the cells where you want the conditional formatting to appear, for example, row $G3:$K3.
Navigate to the 'Home' tab, click on 'Conditional Formatting' in the Styles group, and select 'New Rule'.
Select 'Use a formula to determine which cells to format'. Enter a formula that compares the cell and counts duplicates, such as: =AND($G3:$K3<>"", COUNTIF($G3:$K3,G3)<=COUNTIF($E$15:$I$15,G3)). Adjust the absolute ($) and relative references based on your exact layout.
Click the 'Format' button, choose your desired fill color or font style to highlight the duplicate, and click 'OK'.
Go back to 'Conditional Formatting' > 'Manage Rules'. Review the list of rules applied to the worksheet. Use the 'Up' arrow to move your new custom formula rule to the top, ensuring it takes precedence over general duplicate rules.

Highlight Complex Duplicates Effortlessly in WPS Spreadsheet
WPS Spreadsheet fully supports advanced conditional formatting and custom array formulas, allowing you to highlight specific data patterns quickly without compatibility issues.
- 1. Select Data Range: Open your file in WPS Spreadsheet and highlight the row or columns you want to format.
- 2. Open Conditional Formatting: Go to the 'Home' tab and click on the 'Conditional Formatting' icon.
- 3. Apply Custom Formula: Click 'New Rule', choose 'Use a formula to determine which cells to format', and type in your occurrence-counting formula.
- 4. Customize Appearance: Select your desired highlight color in the formatting settings and confirm by clicking 'OK'.
- 5. Verify Rule Priority: Access 'Manage Rules' from the Conditional Formatting drop-down to ensure your new rule sits at the top of the hierarchy.

Frequently Asked Questions
Why does my conditional formatting highlight the wrong cells?
This usually happens when the formula's relative and absolute references ($) are misaligned with the selected data range. Ensure the first cell referenced in your formula exactly matches the top-left cell of the range you highlighted before creating the rule.
How can I format only the second occurrence of a value in Excel?
You can achieve this by using a COUNTIF formula with an expanding range. For example, the formula =COUNTIF($A$1:A1, A1)=2 will count the occurrences as it moves down the column, triggering the format only when the count exactly hits two.
What does the 'Stop If True' option do in formatting rules?
The 'Stop If True' checkbox in the Manage Rules dialog prevents Excel from processing lower-priority rules if the condition of the current high-priority rule is met. This is highly useful for preventing conflicting format styles on the same cell.




