What is the formula to count duplicates in excel
Tutor 5 (99 Reviews)
Excel Tutor
Still stuck with a Excel question
Ask this expertAnswer
To count duplicates in Excel, you can use several methods depending on whether you want to count duplicates in a single column, across multiple columns, or highlight them.
Method 1: Using COUNTIF to Count Duplicates in a Single Column
A cell can be counted as a duplicate if it appears more than once in the column.
Suppose your data is in column
AfromA2toA20.In cell
B2, enter the formula:=COUNTIF(A$2:A$20, A2)
Press Enter.
Drag the formula down from
B2toB20.
Explanation:
COUNTIFcounts how many times the value inA2appears in the rangeA2:A20.If the result is greater than
1, it indicates a duplicate.
Example:
If
A2 = "Apple"and"Apple"appears 3 times in column A,B2will show3.
Method 2: Count Only Duplicate Entries
To count only values that appear more than once:
Use the formula:
=IF(COUNTIF(A$2:A$20, A2)>1, "Duplicate", "Unique")
This marks each cell as "Duplicate" if it occurs more than once.
Method 3: Count Total Number of Duplicates in a Column
To find how many values are repeated (count total duplicate entries):
Use this formula:
=SUMPRODUCT((COUNTIF(A2:A20, A2:A20)>1)/COUNTIF(A2:A20, A2:A20))
Press Enter.
Explanation:
COUNTIF(A2:A20, A2:A20)creates an array counting occurrences of each value.>1identifies duplicates.SUMPRODUCTtotals them while avoiding double-counting.
Method 4: Highlight Duplicates Using Conditional Formatting
Select the range of cells you want to check for duplicates.
Go to
Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values.Choose a formatting style (e.g., red fill) and click OK.
Note:
Conditional formatting only highlights duplicates. It does not count them.
Method 5: Advanced - Count Duplicates Across Multiple Columns
Suppose the data is in
A2:B20.Use this formula to count duplicates across two columns:
=COUNTIFS(A$2:A$20, A2, B$2:B$20, B2)
This counts rows where both column A and column B values match the current row.
Tips
Excel functions like
COUNTIFandCOUNTIFSare case-insensitive.For case-sensitive duplicate counts, use
SUMPRODUCTwithEXACT:=SUMPRODUCT(--EXACT(A2, A$2:A$20))
This approach ensures precise identification and counting of duplicates in any dataset.
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