I have excel list with some duplicates I want to count total number of duplicated records in table but I can't use Conditional formating as it will highlight both values that are duplicated and just 1 is duplicate..
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
To count the total number of duplicated records in your Excel table, you can use a combination of functions to achieve this. Here's a step-by-step guide:
Using a Helper Column
Create a Helper Column:
Suppose your data is in column A (from A2 to A100). In column B, you will create a helper column to mark duplicates.
Enter the Formula in the Helper Column:
In cell B2, enter the following formula:
excel
=IF(COUNTIF($A$2:$A$100, A2) > 1, 1, 0)
This formula checks if the value in cell A2 appears more than once in the range A2:A100. If it does, it returns 1; otherwise, it returns 0.
Copy the Formula Down:
Drag the fill handle (small square at the bottom-right corner of the cell) down to copy the formula from B2 to B100.
Sum the Helper Column:
In an empty cell (e.g., B101), enter the following formula to count the total number of duplicates:
excel
=SUM(B2:B100)
This will give you the total count of duplicated records.
Using Pivot Table
Alternatively, you can use a Pivot Table to count duplicates:
Select Your Data:
Highlight your data range (e.g., A1:A100).
Insert Pivot Table:
Go to the Insert tab and click on PivotTable.
Choose where you want the Pivot Table report to be placed (e.g., a new worksheet).
Set Up the Pivot Table:
Drag the column containing your data (e.g., Column A) to the Rows area.
Drag the same column to the Values area. By default, it will show the count of values.
Filter for Duplicates:
Click the drop-down arrow next to Row Labels in the Pivot Table.
Select Value Filters and then Greater Than….
Set the filter to count values greater than 1.
This will show you only the duplicated values and their counts. You can then manually count these or use another method to sum them up if needed.
Using Advanced Filter (Unique Records Only)
If you just want to remove duplicates and count them separately:
Select Your Data:
Highlight your data range (e.g., A1:A100).
Apply Advanced Filter:
Go to the Data tab and click on Advanced in the Sort & Filter group.
In the Advanced Filter dialog box, choose Copy to another location.
Set the List range to your data range (e.g., A1:A100).
Set the Copy to range to an empty column (e.g., C1).
Check Unique records only and click OK.
Count Original and Unique Records:
Count the number of records in the original list: =COUNTA(A2:A100).
Count the number of unique records: =COUNTA(C2:C100).
The difference between these two counts will give you the number of duplicated records.