Identify Duplicates

danpre

Board Regular
Joined
Aug 29, 2011
Messages
58
Hi Team,

I Have Data in my excel where i need to findout the Duplicates as well as unique if there are duplicates in the given column.

For eg In Column "M" if there are Five "ABC" so i need all the five ABC as a Duplicates and not only 4 ABC as Duplicates and one as Unique.

ABC
B
C
ABC
ABC
ABC
ABC
D
E

I Hope you understand my requirement and accordingly please provide me the VBA code if you have.

Thanks
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Try in column B
=IF(COUNTIF(A:A, A1)>1, "This and "&(COUNTIF(A:A, A1)-1)&" other occurances.", "Only occurance")

Regards
Adam
 
Upvote 0
This is not working

This code is ignoring the 1st unique record and taking other 4 as Duplicates records and also taking additional record as Duplicate which is not at all duplicate.

Please help
 
Upvote 0
In that case I'm probably not understanding what you're looking for; apologies. This is how it works in my sheet:
Excel Workbook
AB
1ABCThis and 4 other occurances.
2ABCThis and 4 other occurances.
3BOnly occurance
4COnly occurance
5ABCThis and 4 other occurances.
6ABCThis and 4 other occurances.
7AThis and 1 other occurances.
8AThis and 1 other occurances.
9FOnly occurance
10GThis and 1 other occurances.
11ABCThis and 4 other occurances.
12XOnly occurance
13GThis and 1 other occurances.
Sheet1
Excel 2002
Cell Formulas
RangeFormula
B1=IF(COUNTIF(A:A, A1)>1, "This and "&(COUNTIF(A:A, A1)-1)&" other occurances.", "Only occurance")



Of you could try this?

Excel Workbook
AB
1ABCFirst occurance, 4 duplicates later in list.
2ABCDuplicate
3BOnly occurance
4COnly occurance
5ABCDuplicate
6ABCDuplicate
7AFirst occurance, 2 duplicates later in list.
8ADuplicate
9FOnly occurance
10GFirst occurance, 1 duplicates later in list.
11ABCDuplicate
12XOnly occurance
13GDuplicate
14ADuplicate
Sheet1
Excel 2002
Cell Formulas
RangeFormula
B1=IF(AND(COUNTIF(A:A, A1)>1, COUNTIF($A$1:A1, A1)>1), "Duplicate", IF(COUNTIF(A:A, A1)>1, "First occurance, "&(COUNTIF(A:A, A1)-1)&" duplicates later in list.", "Only occurance"))



If this doesn't help, give me some more info on what you're looking for.

Regards
Adam
 
Upvote 0
try this:

Dim toAdd As Boolean, uniqueNumbers As Integer, i As Integer, j As Integer

Cells(1,2).Value = Cells(1,1).Value
uniqueNumbers =1
toAdd = True

For i =2 To 10 (this can be as many as you like)

For j =1 To uniqueNumbers

If Cells(i,1).Value = Cells(j,2).Value Then
toAdd = False
End IF
Next j

If toAdd = Treu Then
Cells(uniqueNumbers + 1,2).Value = Cells(i,1).Value
uniqueNumbers = uniqueNumbers + 1
toAdd = True
Next i
 
Upvote 0
Formula is working fine - Thanks

But when i am using the code which you have given - it is giving me overflow error because i have 55,000 row data.

By the way i didnt understand the code little bit.

I mean if i put VBA code in Editor what output it is going to give me in Column B.

Please help me to understand this code
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,628
Members
452,933
Latest member
patv

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top