Anda di halaman 1dari 4

Find Duplicates and Triplicates in Excel

This entry was posted on November 12, 2012, in Duplicates, Triplicates. Bookmark the permalink. 5 Comments
Conditional Formatting, Easy tricks

and taggedDuplicates,

Excel, Highlight

A NEW VERSION OF THIS POST HAS BEEN PUBLISHED HERE: http://easy-excel.com/?p=503


Is there an easy way to highlight duplicates in a list in Excel?

If you just want to remove duplicates, you can use the Advanced Filter or the built-in Remove Duplicates feature, but what if you want to keep the duplicates in the list and highlight them with a different colour? Ill show you one easy way and one super -easy way!

First, the super-easy way:


Select the cells you want to check and choose Highlight Cell Rules => Duplicate Values from the Home Ribbon.

Then, the easy way


If you only want to locate the duplicates, the super-easy way is the right way to do it. But lets say you want to find triplicates or quadruplicates, i.e. three or four occurrences of the same piece of data. There is no built-in feature for that, so we have to find our own way.

In my example I have 27 rows of data, with names in the range A2 to A28. In A2 we find the name Robert, so if we want to find out how many times Robert appears in the list, this is the formula: =COUNTIF($A$2:$A$28,A2). Well use Conditional Formatting with a formula like this.

As weve seen in a previous post, Conditional Formatting requires a TRUE or FALSE. Lets see how our formula works whe n we put it in the worksheet. We use the same formula as above, only with =1, =2 or =3 in the end, and we will get TRUE or FALSE for each statement:

So, lets put this formula into Conditional Formatting, with one small adjustment: Instead of hard -coding the value after the equal sign (1,2,3 etc.) well use a cell reference. I will have my reference in cell E2.

Select the cells you want to include in the search (A2:A28 in this example) and click on Conditional Formatting from the Home ribbon and choose New Rule (or shortcut: Alt => H => L => N). Choose Use a formula to determine which cells to format and type the formula into the formul a field:

=COUNTIF($A$2:$A$28,A2)=$E$2 Note that the range A2:A28 and the reference to E2 (number of occurrences) have to be locked with dollar signs (shortcut: F4).

The result: All the triplicates are highlighted. If you change the value in E2 to 2, you will get the duplicates instead, and if you change it to 1, only the unique values will be highlighted.

Anda mungkin juga menyukai