Duplicate Code

jthomas24

Board Regular
Joined
Jun 6, 2017
Messages
59
Hello

I am trying to find a simple code to check if there is duplicate values. I have tried looking up code but nothing is making sense to me.

Any help would be appreciated
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Your message can encompass a lot of scenarios, so some detail about what you are working with would be useful to someone trying to help. Also, are you sure you need code to do this? Many native formula approaches can determine duplicate values in a range.
 
Upvote 0
I have code names for places (i.e Adjal) but i want to check if there is ever 2 identical codes. And if there is an easier way I can use it, but i have used conditional formatting and i dont really like the way it presents the duplicates,
 
Upvote 0
How do you want the duplicates to be dealt with? Do you want them deleted, or maybe do you want a list of only unique values but keep the original list untouched? And how would a list be presented - - in a message box or on a different worksheet? What do you want the identification or deletion result to be presented as?

Edit -- I need to step away for a few meetings, so if someone else can can jump in, so much the better. Otherwise I'll be back this afternoon.
 
Last edited:
Upvote 0
If you have a list of values, and want to just check to see if there are any duplicates, one way is to use the COUNTIF formula, and count how many records are equal to the one on that row.
Any value greater than 1 indicates duplicates.

For example, if the data you are checking is in range G2:G100, and you want column H to say "Duplicate" if the value in column G is found more than once in the list, then you can use this formula in cell H2 (and copy all the way down to H100):
Code:
=IF(COUNTIF($G$2:$G$100,$G2)>1,"DUPLICATE","")
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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