# Count Duplicates in Excel: A Simple Guide

The best and most commonly used function to count duplicates in Excel is the COUNTIF function. This function allows users to specify a range of cells and criteria and returns the number of cells within that range that meet the specified criteria. By using the COUNTIF function in combination with conditional formatting, users can quickly identify and highlight duplicate values within their data.

Another useful function for counting duplicates in Excel is the COUNTIFS function. This function allows users to specify multiple criteria and returns the number of cells within a range that meet all of the specified criteria. With the COUNTIFS function, users can easily count the number of duplicate values that meet specific conditions, such as duplicates within a certain date range or duplicates that meet certain criteria.

## How to Count Duplicates:

### Including the First Occurrence

To include the first occurrence of a value when counting duplicates, use the COUNTIF function. This function in general counts the number of cells within a range that meet a certain criteria.

For example, to count the number of times the value “extraforms” appears in column B, including the first occurrence, use the following formula:

`=COUNTIF(B:B,"extraforms")`

This formula will count all instances of “extraforms” in column B, including the first occurrence. It is important to note that this formula is not case-sensitive, therefore Extraforms, eXtRaFoRmS, would also get added to the count, so be mindful of this.

An additional tip not just for this formula but for all Excel use is to limit the range of cells used and not to use the whole column. My dataset here is small so it is not an issue to use B:B and cover the whole column but you will rarely need something bigger than B2:B1000 and it greatly helps Excel’s performance.

### Excluding the First Occurrence

To exclude the first occurrence of a value when counting duplicates, you can, well, just subtract 1 from the previous formula. Most of the time, the easiest solution is the best one. As to what this is used for, excluding the first occurrence helps you keep track of how many duplicates of that value you have and you don’t want to include the first one in the count.

## Count Case-Sensitive Duplicates in Excel

To count case-sensitive duplicates in Excel, we will combine a few different formulas like this:

`=SUMPRODUCT(--EXACT(B:B,"extraforms"))`

In this formula, B:B is the range of cells with duplicates we want to count(column B for example), and “extraforms” is the value for which we are counting duplicates(can be another cell also). The EXACT function is used to compare the cell to be counted with the value and it gives a true or false value. The (–) operator transforms that into an array of values which then the SUMPRODUCT function sums up(counting each true as a 1 and a false as a 0) to give us our final number. As in the previous example, to exclude the first occurrence you can simply subtract 1.

## Counting Duplicate Rows in Excel

To count duplicate rows, you can use Conditional Formatting. This feature highlights duplicate rows in a specific color, making it easy to identify them. To use this feature, select the range of cells that you want to check for duplicates, then go to the “Home” tab and click on “Conditional Formatting”. From there, select “Highlight Cells Rules” and then “Duplicate Values”. Choose the formatting style you want to use and click “OK”. Excel will then highlight all the duplicate rows in the selected range.

## How to Highlight Duplicates in Excel

To highlight the duplicates, we are going to be using conditional formatting. This can be useful for identifying duplicate data entries in a dataset and cleaning up the data for analysis.

To do that, follow the steps bellow:

- Select a range of cells
- Click on the “Conditional Formatting” option in the “Home” tab.

- Select “Highlight Cells Rules” and then “Duplicate Values”.

- Choose the formatting style for the duplicate values and click “OK”.

Once this is done, Excel will highlight all the duplicate values in the selected column.

## Conclusion

Excel provides several ways to count duplicates in a dataset. The COUNTIF function can be used to count the number of times a specific value appears in a range, and the COUNTIFS function can be used to count duplicates based on multiple criteria. Meanwhile, conditional formatting can be used to highlight duplicate values in a dataset, making it easier to identify them

I hope this article helps you deal with duplicates easily next time. If you have suggestions or feedback, make sure to leave a comment ðŸ™‚