To count duplicate values in Excel, several methods can be applied depending on whether you want a simple count, a dynamic formula, or a visual highlight
Method 1: Using the COUNTIF Function
The COUNTIF function is used to count how many times a specific value appears in a range.
Steps:
-
Select the cell where you want the count to appear.
-
Enter the formula:
-
A:Arefers to the entire column where duplicates are checked. -
A2refers to the specific cell value being counted.
-
Press Enter.
-
Drag the formula down to apply it to other cells.
Explanation:
-
If the result is greater than 1, the value is duplicated.
-
This method counts each instance of a value individually.
Method 2: Counting Only Duplicate Values Once
To count the total number of values that are duplicated, without counting each occurrence:
Steps:
-
Use the formula:
-
Press Ctrl + Shift + Enter (Windows) or Command + Shift + Enter (Mac) to make it an array formula.
Explanation:
-
COUNTIF(A:A, A:A)counts all occurrences. -
1/COUNTIF(A:A, A:A)ensures each duplicate is counted only once. -
SUM(...)totals all unique duplicates.
Method 3: Using Conditional Formatting to Highlight Duplicates
This method visually identifies duplicates without counting them in a separate column.
Steps:
-
Select the range of cells to check for duplicates.
-
Go to Home → Conditional Formatting → Highlight Cells Rules → Duplicate Values.
-
Choose a formatting style and click OK.
Explanation:
-
Duplicates will appear highlighted.
-
Counting can be done manually after filtering or using
COUNTIF.
Method 4: Using Pivot Tables
Pivot Tables summarize data and can count duplicates effectively.
Steps:
-
Select your data range.
-
Go to Insert → Pivot Table.
-
Drag the column containing duplicates to Rows and Values.
-
Set Values to Count.
Explanation:
-
Pivot Table counts how many times each value appears.
-
Allows filtering to see only duplicates.
Method 5: Using the UNIQUE and COUNTIF Functions (Dynamic Array Excel 365/2021)
For newer versions of Excel that support dynamic arrays:
Steps:
-
Extract unique values with:
Count duplicates for each unique value with:
Explanation:
-
UNIQUEgenerates a list of distinct values. -
COUNTIFcounts how many times each appears in the original range.
Summary
-
Use
COUNTIFfor individual cell counts. -
Use array formulas for counting duplicates once.
-
Conditional formatting highlights duplicates visually.
-
Pivot Tables provide a summarized count.
-
Dynamic arrays combine
UNIQUEandCOUNTIFfor modern Excel versions.
This ensures accurate detection and counting of duplicate values in Excel for analysis, reporting, or data cleanup.