What is the formula to highlight duplicates
Tutor 5 (99 Reviews)
Excel Tutor
Still stuck with a Excel question
Ask this expertAnswer
The formula to highlight duplicates in Excel is =COUNTIF(range,cell)>1. This formula evaluates whether a value appears more than once within a specified range and returns a logical result that Conditional Formatting uses to apply visual emphasis.
How the duplicate-highlighting formula works
The formula counts how many times a value appears in a defined range and compares the count to a threshold.
\text{COUNTIF}(\text{range}, \text{cell}) > 1
COUNTIF counts matching values in a range.
range defines where Excel searches for duplicates.
cell represents the active cell being evaluated.
> 1 confirms duplication since a unique value appears once.
Excel evaluates this formula for each cell in the selected range and applies formatting where the logical result is TRUE.
How to apply the formula using Conditional Formatting
To highlight duplicates in Excel using a formula, follow this sequence.
Select the target range of cells.
Open the Home tab.
Choose Conditional Formatting.
Select New Rule.
Click Use a formula to determine which cells to format.
Enter the formula:
=COUNTIF($A$1:$A$100,A1)>1
Select a formatting style.
Confirm the rule.
This method highlights all duplicate values while preserving the original data.
How absolute and relative references affect duplicate detection
Absolute references lock the evaluation range, while relative references allow Excel to test each cell independently.
=COUNTIF($A$1:$A$100,A1)>1
$A$1:$A$100 remains constant.
A1 shifts per row during evaluation.
This structure ensures accurate duplicate detection across the full range.
How to highlight duplicates across multiple columns
To identify duplicates across multiple columns, expand the COUNTIF range.
=COUNTIF($A$1:$C$100,A1)>1
This configuration checks every value against all specified columns, enabling cross-column duplicate detection.
Built-in duplicate highlighting vs formula-based rules
Excel includes a preset duplicate rule, though formula-based rules provide greater control.
Built-in rules highlight duplicates instantly.
Formula-based rules support dynamic ranges, exclusions, and multi-column checks.
Formula rules allow consistency across structured datasets.
Formula-based Conditional Formatting supports advanced data validation standards used in professional analysis.
Differences between Windows and Mac
Duplicate highlighting formulas function identically on Windows and Mac.
Menu paths are the same.
Formula syntax remains unchanged.
Formatting options display minor visual differences.
No functional limitations exist between platforms for this task.
Common errors and how to prevent them
Incorrect duplicate highlighting occurs due to reference misuse or range mismatch.
Lock the COUNTIF range using absolute references.
Start the formula from the active cell.
Avoid mixed data types within the same range.
Correct formula structure ensures consistent and accurate duplicate detection across datasets.
. Was this Helpful?Related Questions
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 freeze a row in excel
Answers · 1
How to freeze the top three rows in excel
Answers · 1
How to freeze the top two rows in excel
Answers · 1
How to freeze top row excel mac
Answers · 1