Inside The Web
    Facebook Twitter Instagram
    Inside The Web
    • Office
      • Excel
      • Ms Word
      • Gmail
    • Productivity
      • Time Management
      • Task Automation
    Inside The Web
    Home»Excel»How to Count Duplicates in Excel

    How to Count Duplicates in Excel

    jabinBy jabinMarch 5, 2023 Excel 5 Mins Read

    While Excel has several tools for removing duplicate values from a cell range, you may occasionally need to count them instead.

    This is particularly useful if you want to identify your most frequent customer or pinpoint which products are selling the most. In such cases, knowing the frequency of duplicates can help you make strategic plans and increase your sales.

    In this article, we explain how you can check for the total number of duplicates in a single column. Also, you can find the frequency of duplicate records/rows too.

    Before you begin, save a copy of the original data so that you can revert to it in case you get a different result than expected.  And, it's better to convert your data into a table (Ctrl + T) as it automatically counts any new duplicate entry you add later.

    Case 1: Total Number of Duplicates across Rows or Columns

    To find the total number of duplicate records in single/multiple columns, you can consider the Remove Duplicates option or use the COUNTIF function.

    But, if you are also looking for the number of duplicates for each item in the column or count duplicate records in the dataset, continue reading.

    Using the Remove Duplicates Method

    1. Open the worksheet that contains the data and select a cell on your dataset.
      Select-cell-in-dataset
    2. Click the Remove Duplicates icon inside the Data Tools section. You can find it under the Data tab.
      Remove-duplicates
    3. On the Remove Duplicates prompt, click Select All to check the total number of duplicate rows/records.
      Select-all-columns
    4. To check for duplicates in a single column, click Unselect All and only enable its checkbox. Here, we selected the Name column to count the total number of duplicate names in it.
      Select-single-column
    5. Also, enable the My data has headers checkbox.
    6. On the next prompt, check the total number of duplicate records. Here, the record {Jack,80,Math} repeated four times and had three duplicates.
      Total-number-of-duplicate-records
    7. Similarly, while checking for duplicates in the Names column, the name Jack had three duplicates and Jerry had one, resulting in a total of 4 duplicate values.
      Duplicates-in-a-single-column-(Names-column)

    Using the COUNTIF Function

    To directly find the total number of duplicates inside a column, you can use the COUNTIF function in combination with the UNIQUE function.

    Syntax: =COUNTIF(cell range,criteria)

    Where, 

    • Cell range: cell reference of the cells inside the column
    • Criteria: cell reference of the item to check for duplicates inside the column

    Similarly, the syntax for the UNIQUE function is =UNIQUE(range)

    Where,

    • Range: cell range from which you want to extract unique items only

    Now, we can use the following formula as follows.

    =COUNTA(cell range)-COUNTA(UNIQUE(cell range))

    Let’s take a look at an example to better understand the use of the above formula.

    Here,

    COUNTA returns the total number of non-empty cells. But, note that it will still include the cells that contain spaces while counting.

    The UNIQUE function returns the cells containing only the unique values.

    So, we can evaluate the above formula as follows.

    COUNTA($B$3:$B$10)-COUNTA(UNIQUE($B$3:$B$10))

    Where, 

    COUNTA($B$3:$B$10) returns 8.
    total-number-of-names-in-Names-column

    UNIQUE($B$3:$B$10) returns a list of unique names.
    Unique-names-in-Names-column

    Thus, the COUNTA(UNIQUE($B$3:$B$10)) function returns 4 as there are four unique names. So, the whole formula COUNTA($B$3:$B$10)-COUNTA(UNIQUE($B$3:$B$10)) evaluates to 8-4, which equals 4.
    Total-duplicate-names-using-COUNTA-and-UNIQUE-function

    Case 2: Find the Number of Duplicates in a Single Column

    Using the COUNTIF Function

    Using the COUNTIF function, you can calculate the total number of occurrences of an item inside a column. 

    For instance, =COUNTIF(A: A, A1) checks for every occurrence of the A1 cell value in the entire column A.

    After finding the occurrence of each item, you can subtract 1 from them to calculate the total number of duplicates for each item.

    1. Create a helper column and give it an appropriate name such as “Unique List”. Then, extract the unique items there. You can use the UNIQUE function as mentioned above.  Since we converted our data into a table, we used the structured reference here. But, you can just enter the name column’s cell range (A2:A9) if it’s easier for you.
      Extract-unique-items-of-a-column
    2. Create another helper column to display the frequency of each duplicate item. Here it’s called “Number of duplicates”.
    3. Use the COUNTIF function to search for duplicates of one item. Here, in the formula, =COUNTIF(A: A, E2)-1, we are counting the number of times the E2 cell value (Jack in this case), has appeared across the whole column A, except for the first occurrence.
      count-number-of-duplicates-of-an-item-in-a-column
    4. Then, use the drag handle to find the total number of duplicates for other items in the list.
      Use-the-drag-handle
    5. After using the drag handle, the final result is as follows.
      Count-the-frequency-of-each-duplicate-item-in-the-column

    Case 3: Count Duplicate Records/Rows

    Counting duplicate records requires some additional steps. Here, you merge all the columns into one after which you can calculate the number of duplicates similar to how we calculated for a single column.

    Step 1: Merge Columns

    First, create a helper column that will contain all the merged columns. To merge the columns, you can use the CONCAT function.

    Syntax:=CONCAT(cells you want to concatenate)

    To concatenate cell values of multiple columns, type =CONCAT(, and select a row/record. Then, enclose the round bracket to complete the formula and press Enter.

    Now, use the Flash fill or drag handle to merge other columns.

    Step 2: Create the Necessary Columns

    Create two helper columns to extract the unique records and list the number of duplicate records for each record. Here, we have “Unique records” and “Number of duplicates”.

    Step 3: Extract Unique Values

    To get the unique records, you can use the UNIQUE function.

    First, type =UNIQUE( and select the cell range of the merged column. Then, enclose it with the round bracket and press Enter.

    Step 4: Count Duplicates

    Now, to count the number of duplicate records, use the COUNTIF function similar to how we calculated for a single column in CASE 2.

    In the above image, we checked for the occurrence of Jack80Math in the entire “Merged Column” column. Notice that we used Jack80Math inside the Unique Records column as we only want to count the frequency of duplicate records once only.

    Excel Basics Excel Functions
    jabin

      As a tech content writer, Jabin covers Excel-related articles at InsideTheWeb. His articles mainly involve helping new users to quickly familiarize themselves with the Excel interface and explaining various essential features. While he got introduced to Excel in his early school days, he developed a keen interest in it after working on a college project. He was impressed at how quickly one could accomplish several tasks with built-in functions like the filter function and user-friendly tools like the power query. Keeping beginner audiences in mind, he loves to explain even the most fundamental Excel concepts in detail and break down complex topics with a step-by-step approach. As an avid Excel user, he believes every task can be done a lot quicker if you know the right tools and techniques. When he’s not behind a keyboard, he loves to listen to interesting audiobooks and podcasts.

      Add A Comment
      Table of Contents
      • Case 1: Total Number of Duplicates across Rows or Columns
        • Using the Remove Duplicates Method
        • Using the COUNTIF Function
      • Case 2: Find the Number of Duplicates in a Single Column
        • Using the COUNTIF Function
      • Case 3: Count Duplicate Records/Rows
        • Step 1: Merge Columns
        • Step 2: Create the Necessary Columns
        • Step 3: Extract Unique Values
        • Step 4: Count Duplicates
      Recent Posts
      • How to Calculate Discount Percentage in Excel
      • How to Create a Progress Bar in Excel
      • What is VSTACK in Excel
      • How to Separate Dates in Excel
      • How to Lock a Cell in Excel Formula
      • Home
      • Privacy Policy
      © 2023 Inside The Web

      Type above and press Enter to search. Press Esc to cancel.