Checking For Duplicates

kparadise

Board Regular
Joined
Aug 13, 2015
Messages
186
So I have a table of records. Each row is a record that contains 5 columns of items. I created these records manually, but now i need to identify any records (rows) that contain the same values across the 5 columns. See below: the first and third records are duplicates because they contain the same 5 value regardless of which column they fall in.

ABCDEF
1ITEMITEMITEMITEMITEMDUP?
2appleorangegrapedogcatY
3bug appleorangecatdogN
4orangeappledogcatgrapeY
5dogbirdbananacatgrapeN

<tbody>
</tbody>
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Probably a better solution, but try

=IF(AND(COUNTIFS($A:$E,A3)>1,COUNTIFS($A:$E,B3)>1,COUNTIFS($A:$E,C3)>1,COUNTIFS($A:$E,D3)>1,COUNTIFS($A:$E,E3)>1),"Y","N")

Gaz
 
Upvote 0
I see this, but it will not provide me with the results I want. I will only give me a "Y" for the second duplicate record, it will not give me a "Y" for both duplicate records.
 
Upvote 0
Seems to work ok for me!

Code:
[TABLE="width: 609"]
<tbody>[TR]
[TD="width: 87"][/TD]
[TD="width: 87"][/TD]
[TD="width: 87"][/TD]
[TD="width: 87"][/TD]
[TD="width: 87"][/TD]
[TD="width: 87"][/TD]
[TD="width: 87"][/TD]
[/TR]
[TR]
[TD="class: xl63"]ITEM[/TD]
[TD="class: xl63"]ITEM[/TD]
[TD="class: xl63"]ITEM[/TD]
[TD="class: xl63"]ITEM[/TD]
[TD="class: xl63"]ITEM[/TD]
[TD="class: xl63"]DUP?[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl63"]apple[/TD]
[TD="class: xl63"]orange[/TD]
[TD="class: xl63"]grape[/TD]
[TD="class: xl63"]dog[/TD]
[TD="class: xl63"]cat[/TD]
[TD="class: xl64"]Y[/TD]
[TD="class: xl65, align: center"]Y[/TD]
[/TR]
[TR]
[TD="class: xl63"]bug[/TD]
[TD="class: xl63"]apple[/TD]
[TD="class: xl63"]orange[/TD]
[TD="class: xl63"]cat[/TD]
[TD="class: xl63"]dog[/TD]
[TD="class: xl63"]N[/TD]
[TD="class: xl65, align: center"]N[/TD]
[/TR]
[TR]
[TD="class: xl63"]orange[/TD]
[TD="class: xl63"]apple[/TD]
[TD="class: xl63"]dog[/TD]
[TD="class: xl63"]cat[/TD]
[TD="class: xl63"]grape[/TD]
[TD="class: xl64"]Y[/TD]
[TD="class: xl65, align: center"]Y[/TD]
[/TR]
[TR]
[TD="class: xl63"]dog[/TD]
[TD="class: xl63"]bird[/TD]
[TD="class: xl63"]banana[/TD]
[TD="class: xl63"]cat[/TD]
[TD="class: xl63"]grape[/TD]
[TD="class: xl63"]N[/TD]
[TD="class: xl65, align: center"]N[/TD]
[/TR]
[TR]
[TD="class: xl63"]grape[/TD]
[TD="class: xl63"]cat[/TD]
[TD="class: xl63"]dog[/TD]
[TD="class: xl63"]apple[/TD]
[TD="class: xl63"]orange[/TD]
[TD][/TD]
[TD="class: xl65, align: center"]Y[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
That formula will not work in some cases, such as


Excel 2013/2016
ABCDEF
1ITEMITEMITEMITEMITEMDUP?
2appleorangegrapedoggrapeY
3bugappleorangecatdogY
4orangeappledogcatgrapeY
5dogbirdbananacatgrapeN
6appleorangebuggrapehorseN
Jan2
Cell Formulas
RangeFormula
F2=IF(AND(COUNTIFS($A:$E,A2)>1,COUNTIFS($A:$E,B2)>1,COUNTIFS($A:$E,C2)>1,COUNTIFS($A:$E,D2)>1,COUNTIFS($A:$E,E2)>1),"Y","N")


That said I'm not sure how to improve it.
 
Upvote 0
One way would be to create a helper column along with a custom function to take the 5 cells sort them alphabetically and join them together to make a unique string for your helper column and then use countif after that to highlight the duplicates
 
Upvote 0
Guess it depends on OP's interpretation of "Duplicates", it works if the word is duplicated no matter where the duplicate is.
 
Upvote 0
Agreed, but based on this
Code:
the first and third records are duplicates because they contain the [B]same 5 value[/B] regardless of which column they fall in.
I read it that all 5 values must be in the same row.
But I could be wrong.
 
Upvote 0

Forum statistics

Threads
1,215,695
Messages
6,126,263
Members
449,307
Latest member
Andile

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