How to highlight duplicate cells
Tutor 5 (54 Reviews)
Excel Tutor
Still stuck with a Excel question
Ask this expertAnswer
To
highlight duplicate cells in Excel, use the built-in Conditional
Formatting rule (Home > Conditional Formatting > Highlight Cells
Rules > Duplicate Values) for instant highlighting of all duplicates
including first occurrences, or create custom formula rules with COUNTIF
(e.g., =COUNTIF($A$2:$A$100,A2)>1) for greater control over which cells highlight. These methods update dynamically as data changes.
What methods does Excel offer to highlight duplicate cells?
Excel provides three primary methods to highlight duplicate cells, ordered by ease and popularity:
- Built-in Conditional Formatting (easiest, most popular): Select the cell range, go to Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values, pick a preset color like Light Red Fill, and click OK. All duplicates including first occurrences highlight instantly.
- Custom formula rule (high popularity, more control): Select the range, then use Home > Conditional Formatting > New Rule > Use a formula with
=COUNTIF($A$1:$A$100,A1)>1. This approach excludes first occurrences unlike the built-in rule and supports case-sensitive matching. - Helper column with COUNTIF (flexible for analysis): Add a column with
=COUNTIF(A:A,A1)>1, then apply Conditional Formatting based on TRUE values. This method allows filtering, counting, and sorting alongside highlighting.
How to use the built-in duplicate values rule
To use the built-in Duplicate Values rule, access Conditional Formatting from the Home tab and select a highlighting style. This rule highlights all duplicate cells including first occurrences with one click.
Apply the rule
- Select the target range, such as A1:A100.
- Ensure no headers are included when unwanted highlighting could occur.
- Go to Home tab > Conditional Formatting > Highlight Cells Rules > Duplicate Values.
- Confirm "Duplicate" is selected under "Format cells that contain" (this is the default).
- Select a style from presets like Light Red Fill with Dark Red Text, Light Red Fill, or Bright Red Text.
- Click OK.
Custom formatting options
- Click Custom Format in the dialog for advanced choices.
- Use the Font tab to change color, apply bold, or set italic styling.
- Use the Border tab to select line style and color.
- Use the Fill tab for solid colors, gradients, or patterns.
- Preview changes and click OK to apply.
Manage the rule
Access Conditional Formatting > Manage Rules to edit, duplicate, or delete existing rules. The rule works on values while ignoring formatting and case by default. Select "Unique" instead of "Duplicate" in the dialog to highlight unique values instead. Highlights update dynamically when data changes.
How to use custom formula rules for more control
To use custom formula rules for highlighting duplicate cells, create a Conditional Formatting rule with COUNTIF and adjust the formula for scenarios like excluding first occurrences or enabling case sensitivity.
Basic steps
- Select the range (e.g., A2:A100) with A2 as the active cell.
- Go to Home > Conditional Formatting > New Rule.
- Select "Use a formula to determine which cells to format."
- Enter a COUNTIF formula (see variations below).
- Click Format, choose a fill color such as red, and click OK.
- Click OK again to apply the rule.
Formula variations
Include first occurrences: =COUNTIF($A$2:$A$100,A2)>1
This formula highlights all duplicate cells including the first instance of each duplicated value. The absolute range reference (A$2: A$100) searches the entire column for matches.
Exclude first occurrences: =COUNTIF($A$2:A2,A2)>1
This formula uses an expanding range ($A$2:A2) that grows as the rule evaluates each cell. The first occurrence returns a count of 1, so only subsequent matches highlight.
Case-sensitive matching: =SUMPRODUCT(--(EXACT($A$2:$A$100,A2)))>1
This formula uses EXACT within SUMPRODUCT to perform case-sensitive comparisons. "ABC" and "abc" are treated as different values.
Consecutive duplicates only: =A2=A1
This formula highlights cells that match the cell directly above. Use =A2=A3 to check against the cell below instead.
Management tips
Edit rules via Conditional Formatting > Manage Rules. Lock ranges with $ signs for stability in expanding datasets. Test formulas on sample data to verify correct behavior before applying to large ranges.
How to use helper columns to highlight duplicate cells
To use helper columns for highlighting duplicate cells, create a column with COUNTIF that labels duplicates, then apply Conditional Formatting based on those labels. This method provides numeric counts or TRUE/FALSE flags useful for auditing and analysis.
Create the helper column
- Insert a new column adjacent to your data (e.g., column B for data in column A starting at A2).
- Label the header "Duplicate Check" in B1.
- In B2, enter
=COUNTIF($A$2:$A$100,A2)>1to flag all duplicates including first occurrences. - Use
=COUNTIF($A$2:A2,A2)>1instead to exclude first occurrences. - Copy the formula down using the fill handle to cover all data rows.
- Results display TRUE for duplicates and FALSE for unique values.
Apply Conditional Formatting
- Select the original data range A2:A100.
- Go to Home > Conditional Formatting > New Rule.
- Select "Use a formula to determine which cells to format."
- Enter
=$B2=TRUE - Click Format, choose red fill, and click OK.
- Click OK again to apply.
- Duplicate cells highlight dynamically based on the helper column values.
Benefits of helper columns
Helper columns provide exact occurrence counts when using =COUNTIF($A:$A,A2)
without the >1 comparison, showing 3 for triplicates or 2 for
duplicates. Users can filter the helper column for values greater than 1
to isolate duplicates. Sorting by the helper column groups duplicates
together. The method supports multi-column checks using COUNTIFS in the
helper formula. Helper columns offer transparency for quality control
reviews compared to hidden Conditional Formatting rules.
How to highlight duplicate cells across multiple columns
To highlight duplicate cells across multiple columns or non-adjacent ranges, use custom Conditional Formatting formulas with COUNTIFS or helper columns combining values. Built-in rules treat multiple columns separately, so custom approaches are required for cross-column duplicate detection.
Multiple adjacent columns (row duplicates)
- Select the range spanning all columns (e.g., A2:C100).
- Go to Home > Conditional Formatting > New Rule.
- Select "Use a formula to determine which cells to format."
- Enter
=COUNTIFS($A$2:$A$100,A2,$B$2:$B$100,B2,$C$2:$C$100,C2)>1 - This formula flags rows where all column values match another row, excluding first occurrences.
- Set a format and click OK twice to apply.
Multiple adjacent columns (any duplicate within block)
- Select the range A2:C100.
- Create a New Rule with the formula
=COUNTIF($A$2:$C$100,A2)>1 - This formula searches the entire block for any matching value regardless of column position.
- Set a format and apply.
Non-adjacent ranges
- Create a helper column (e.g., D2) with
=TEXTJOIN("|",TRUE,A2,C2)to combine values from columns A and C. - Copy the formula down for all rows.
- Select the source data ranges.
- Apply Conditional Formatting with the formula
=COUNTIF($D$2:$D$100,D2)>1 - Duplicates across the specified non-adjacent columns highlight based on the combined key.
Alternative formula for non-adjacent ranges
Use =SUMPRODUCT(--(COUNTIF(($A$2:$A$100,$C$2:$C$100),A2)>1))>0
in a formula rule to check duplicates across non-adjacent column
selections without a helper column. Manage multiple rules through
Conditional Formatting > Manage Rules to set priority when combining
row-level and cell-level duplicate highlighting.
Get Online Tutoring or Questions answered by Experts.
You can post a question for a tutor or set up a tutoring session
Answers · 1
How to show duplicates in red
Answers · 1
How to apply duplicate conditional formatting rule
Answers · 1
How to duplicate conditional formatting excel
Answers · 1
What is excel conditional formatting duplicates
Answers · 1