Aug 28 2008

Quick Way to Check for Duplicates in a Column

I have been using this quick trick lately to check for duplicates in a column of values.  Let’s say you have a list of a large group of numbers (characters work as well) and want to see if you have more than one instance of any of the numbers.  To check for that, one simple was is to use the CountIf formula.

I have already shown you how to use the formula in the SumIf and CountIf Foumulas post. But here I just wanted to mention this is an example where you can use it.

Let’s say we have a column, say column D, with 100 values that you want to confirm do not have any duplicates. To check this, in a column next to the data you are dealing with you can add this formula:

=countif($D$1:$D$100, D1)

Basically what this is saying is count how many times the value of D1 is in the column D for rows 1 to 100. The reason we had to lock the cells (the $ character locks the cells) is that we will need to drag down the formula to do our check. If anything other than 1′s appear in our check column, then we know that we have a duplicate item somewhere. Any easy way to look for the non-1 numbers is to filter the data and look in the drop-down filters available.

Here’s a quick screenshot of how the formula would work for you:

 Countif for Duplicates

That was just a quick tip for today. There are numerous other ways to check for duplicate items in a column, such as using pivottables, but this is a quick and easy trick that you can start using today.

** Excel Hints provides Excel Tips and Excel Help for All Levels of Experience.

More Excel Tips

Did you find this post helpful? Try signing up for our free daily tips.

Enter your email address: 

          

9 Comments on this post

Trackbacks

  1. ksarda said:

    Here’s a question I see often. “I’m trying to use the RANK function to sort the values in Column A, but, the problem arises when I have two or more cells with the same value. Then, the RANK also repeats some positions. For example, if I have, 50, 60, 62, 62, 67 in Column A I would get 5,4,2,2,1 in Column B. Is there a way I can get 4,3,2,2,1 ?”

    May 14th, 2009 at 11:42 am
  2. john said:

    Hi ksarda – the rank function is actually doing the ranking correctly as there is no 3rd position in your example because of the tie for the 2nd position. You would have to write a custom function to rank the values in the manner you suggest. Hope that helps…

    May 14th, 2009 at 12:16 pm
  3. Kaye said:

    Thanks for the tip, this will be useful. Further, would CountIf work if I’m looking at hundreds of rows of customer order info and want to only have customer listed once with columns that include the various dates of orders. That way I don’t have to keep scrolling up and down…I don’t know that CountIf is the solution or not. Thank you.

    August 26th, 2009 at 5:40 pm
  4. Anil said:

    Hi ,

    With regards to “Way to Check for Duplicates in a Column “..there is another way this can be done using the “Conditional Formating ” function. From the Formating menu select “Conditional Formating” in the “Conditions ” select ‘Formula Is ” Option and enter the formula =COUNTIF($A$1:$A$50,A1)>1. Then just select the format you want the duplicates to be displayed in .

    Ensure that this formation is copied to all the other vertical cells you want to chek for duplicates.

    December 20th, 2009 at 5:08 am
  5. iphone_addict said:

    Thanks for the tip, I hope it works for columns that have strings instead of values. Will try this later.

    July 15th, 2010 at 5:50 am
  6. Stu Cram said:

    I also would like to determine ranks without skipping positions when there are ties, similar to the way ksarda mentioned earlier (May 14, 2009). If a custom function is needed, what would its code be? Hopefully someone can give an example of this.

    July 3rd, 2011 at 9:44 am
  7. yousuf said:

    I Have Multiple Duplicate Data in one column,how to Mark Duplicate Data After the number or Before Like this 1,2,3
    Here is what my Excel
    044 24466880
    044 24522150
    044 66590691
    044 24522150
    044 26541242
    044 24466880

    044 66590691
    044 42122525
    044 24929532
    044 42122525

    044 42122525
    044 66590691
    044 24466880
    044 43069000

    January 17th, 2013 at 12:49 am
  8. yousuf said:

    My Excel is in Complicated Mode how to Remove in Normal Way

    January 17th, 2013 at 12:50 am
  9. Justyna said:

    Hi,

    I have a column with list of item numbers and some products are the same with just different 2 last digits..how to find those values?
    ex.134-567-200
    134-567-205 and this is the same product but with new item number..is there any way to check for those values in excel??

    March 27th, 2013 at 10:51 am

LEAVE A COMMENT

Subscribe Form

Subscribe to Blog

  • Expert Excel Consultants for Business
  • Advertise Here

Sign Up for Excel Hints

Free updates with Excel Hints, Tips & Tricks

Categories