How to compare duplicates in excel

The Compare Tables add-in compares two Excel lists for duplicate and unique rows.

Duplicate rows are the rows that are present in both the first and the second table. Unique rows are the rows that are present in table 1 but are missing in table 2. The add-in searches for duplicates and uniques by the key columns you select. The dupes and uniques are identified only in table 1.

Before you start

Excel instances

Please make sure both tables are opened in Excel. They can be in different files but the add-in will compare them as long as they are open in the same instance of Excel.

Backup copies

We strongly recommend keeping the checkbox Create a backup copy of the worksheet selected, as Excel won't let you undo the changes made by the add-in.

How to use Compare Tables

Start Compare Tables

Click the Compare Tables icon in the Dedupe group on the Ablebits Data tab:

How to compare duplicates in excel

Step 1. Select table 1

Once you start the add-in, you will see the step you are on at the top of the window.

First, select the range with your table 1: all changes will be applied to the table you select on this step.

How to compare duplicates in excel

If you select just one cell in the table, the add-in will automatically highlight the used range at the start. You can change the range by editing it manually in the Select your first table field, using the Select range icon there, or simply by choosing the right cells in Excel.

How to compare duplicates in excel

Step 2. Pick table 2

On this step, you can see all open workbooks and worksheets in the Select your second table field. Choose the second Excel worksheet to check for the same values there:

How to compare duplicates in excel

Note. If your second table is in another workbook, make sure to open it before starting the add-in.

Click any cell in a table, and get the entire used range selected automatically. If you need to use only a specific range for comparison, click the Select range icon and highlight the necessary cells.

Tip. If you realize that something was chosen incorrectly, you can always get back to the previous step by clicking the Back button.

When the second table is chosen, click Next.

Step 3. Choose the type of data you are searching for

Here you are to indicate what you are looking for in table 1:

How to compare duplicates in excel

  • Select Duplicate values to find the entries that are present in both table 1 and table 2.
  • Choose Unique values to mark the rows that are present in table 1 but are missing in table 2.

Click Next.

Step 4. Select the columns for comparison

This step displays a list of columns in both Excel spreadsheets.

Select the column(s) from the first table and the matching column(s) from the second worksheet to compare them and check for duplicate or unique data.

How to compare duplicates in excel

  1. You can indicate if you have header rows with the help of Table 1 has headers and Table 2 has headers options respectively. You can also check the 1st row content to make sure you match the right records.
  2. If you have empty cells in your tables, tick the Skip empty cells option to ignore them while searching for duplicates and uniques in two Excel worksheets.
  3. Take advantage of the Auto Select button to quickly select all columns with matching headers. Click Unselect All to remove the selection from all columns.

Once the columns are chosen, click the Next button.

Step 5. Specify the desired action

Finally, you can choose how to deal with the found duplicate or unique rows. The add-in offers plenty of options:

How to compare duplicates in excel

  • You can remove duplicate or unique values from the first table by ticking Delete values.
  • To change the background color of the found rows, check Highlight with color and pick the needed hue from the drop-down list.
  • If you choose to Select values, the rows with the found Excel dupes or uniques will be simply highlighted in your first spreadsheet.
  • Select the Identify in the Status column option to insert a special column into your main table and mark duplicates or uniques there:
    How to compare duplicates in excel
  • You can also copy or move the found results to another location: a new Excel workbook, new or existing worksheet. For this, tick the required option and select the location of the result.

Click Finish and voila! The dupes or uniques are found in your table 1 and processed the way you need!

How to compare duplicates in excel

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

()

Duplicate Values | Triplicates | Duplicate Rows

This example teaches you how to find duplicate values (or triplicates) and how to find duplicate rows in Excel.

Duplicate Values

To find and highlight duplicate values in Excel, execute the following steps.

1. Select the range A1:C10.

How to compare duplicates in excel

2. On the Home tab, in the Styles group, click Conditional Formatting.

How to compare duplicates in excel

3. Click Highlight Cells Rules, Duplicate Values.

How to compare duplicates in excel

4. Select a formatting style and click OK.

How to compare duplicates in excel

Result. Excel highlights the duplicate names.

How to compare duplicates in excel

Note: select Unique from the first drop-down list to highlight the unique names.

Triplicates

By default, Excel highlights duplicates (Juliet, Delta), triplicates (Sierra), etc. (see previous image). Execute the following steps to highlight triplicates only.

1. First, clear the previous conditional formatting rule.

2. Select the range A1:C10.

3. On the Home tab, in the Styles group, click Conditional Formatting.

How to compare duplicates in excel

4. Click New Rule.

How to compare duplicates in excel

5. Select 'Use a formula to determine which cells to format'.

6. Enter the formula =COUNTIF($A$1:$C$10,A1)=3

7. Select a formatting style and click OK.

How to compare duplicates in excel

Result. Excel highlights the triplicate names.

How to compare duplicates in excel

Explanation: =COUNTIF($A$1:$C$10,A1) counts the number of names in the range A1:C10 that are equal to the name in cell A1. If COUNTIF($A$1:$C$10,A1) = 3, Excel formats cell A1. Always write the formula for the upper-left cell in the selected range (A1:C10). Excel automatically copies the formula to the other cells. Thus, cell A2 contains the formula =COUNTIF($A$1:$C$10,A2)=3, cell A3 =COUNTIF($A$1:$C$10,A3)=3, etc. Notice how we created an absolute reference ($A$1:$C$10) to fix this reference.

Note: you can use any formula you like. For example, use this formula =COUNTIF($A$1:$C$10,A1)>3 to highlight names that occur more than 3 times.

To find and highlight duplicate rows in Excel, use COUNTIFS (with the letter S at the end) instead of COUNTIF.

1. Select the range A1:C10.

How to compare duplicates in excel

2. On the Home tab, in the Styles group, click Conditional Formatting.

How to compare duplicates in excel

3. Click New Rule.

How to compare duplicates in excel

4. Select 'Use a formula to determine which cells to format'.

5. Enter the formula =COUNTIFS(Animals,$A1,Continents,$B1,Countries,$C1)>1

6. Select a formatting style and click OK.

How to compare duplicates in excel

Note: the named range Animals refers to the range A1:A10, the named range Continents refers to the range B1:B10 and the named range Countries refers to the range C1:C10. =COUNTIFS(Animals,$A1,Continents,$B1,Countries,$C1) counts the number of rows based on multiple criteria (Leopard, Africa, Zambia).

Result. Excel highlights the duplicate rows.

How to compare duplicates in excel

Explanation: if COUNTIFS(Animals,$A1,Continents,$B1,Countries,$C1) > 1, in other words, if there are multiple (Leopard, Africa, Zambia) rows, Excel formats cell A1. Always write the formula for the upper-left cell in the selected range (A1:C10). Excel automatically copies the formula to the other cells. We fixed the reference to each column by placing a $ symbol in front of the column letter ($A1, $B1 and $C1). As a result, cell A1, B1 and C1 contain the same formula, cell A2, B2 and C2 contain the formula =COUNTIFS(Animals,$A2,Continents,$B2,Countries,$C2)>1, etc.

7. Finally, you can use the Remove Duplicates tool in Excel to quickly remove duplicate rows. On the Data tab, in the Data Tools group, click Remove Duplicates.

How to compare duplicates in excel

In the example below, Excel removes all identical rows (blue) except for the first identical row found (yellow).

How to compare duplicates in excel
How to compare duplicates in excel

Note: visit our page about removing duplicates to learn more about this great Excel tool.