Cookies help us deliver our services. By using our services, you agree to our use of cookies.
Tip: Other languages are Google-Translated. You can visit the English version of this link.
or

Register

or

## How to find duplicate values in two columns in Excel?

When we use a worksheet, sometimes we need to compare two columns and find the same values. For example, I have two long columns of student names, and now, I want to compare them and find out the same names. If I compare them cell by cell, it will be tiresome and waste a lot of time. Are there any quick ways to finish this task?

Find duplicate values in two columns with Formula

Find duplicate values in two columns with VBA code

#### Easily Combine columns or rows without losing data in Excel

With Kutools for Excel's Combine Columns and Rows utility, you can quickly combine multuple cells based on row/column and separated by comma or space, or combine a range of cells into a single cell with specific separator.
For instance, here I do thses operations: (1.)Select Select Combine columns under To combine selected cells according to following options; (2.)Specify a separator for the combined data, here I select Space; (3.))Specify the cell you want to place your combined result; (4.)Specify how you want to deal with the combined cells.  Click for full-featured free trial in 60 days!

#### Find duplicate values in two columns with Formula

###### Amazing! Using Efficient Tabs in Excel Like Chrome, Firefox and Safari!

Look at the following screenshot, I have column A (A2:A15) and column C (C2:C13) which contain some duplicate names.

By using a formula, we can compare two columns and display the duplicate values. Please do with the following steps:

1. In cell B2, input this formula: =IF(ISERROR(MATCH(A2,\$C\$2:\$C\$13,0)),"",A2).

Note: In the above formula: A2 is the column which you want to be compared. \$C\$2:\$C\$13 is the range that you want to be compared with. You can change the variables for what you are using.

2. Press the Enter key. Select cell B2, and then drag the fill handle over cell B15. And all of the duplicate names will be displayed in column B. See screenshot:

#### Find duplicate values in two columns with VBA code

The following VBA code can also help you to find out the duplicate values between two columns.

1. Click Developer > Visual Basic, a new Microsoft Visual Basic for applications window will be displayed, click Insert > Module, and input the following code into the Module:

VBA code: find duplicates from two columns

```Sub Compare()
Dim Range1 As Range, Range2 As Range, Rng1 As Range, Rng2 As Range, outRng As Range
xTitleId = "KutoolsforExcel"
Set Range1 = Application.Selection
Set Range1 = Application.InputBox("Range1 :", xTitleId, Range1.Address, Type:=8)
Set Range2 = Application.InputBox("Range2:", xTitleId, Type:=8)
Application.ScreenUpdating = False
For Each Rng1 In Range1
xValue = Rng1.Value
For Each Rng2 In Range2
If xValue = Rng2.Value Then
If outRng Is Nothing Then
Set outRng = Rng1
Else
Set outRng = Application.Union(outRng, Rng1)
End If
End If
Next
Next
outRng.Select
Application.ScreenUpdating = True
End Sub
```

2. Click button to execute the code, in the popped out box select Range 1 that you want to compare.

3. Click OK and go on selecting Range 2 that you will be compared with.

4. Then click OK, and the duplicate values both in column A and column C have been selected in column A.

Note: If you want to select the duplicates from column C, you just need to swap the two selected columns.

#### Quickly find duplicate values in two columns with Kutools for Excel

With the help of Kutools for Excel, you can find the duplicate values quickly and comfortably.

 with more than 300 handy functions, makes your jobs more easier. Free DownloadFull future 60 days free trial

After installing Kutools for Excel, please do as below:

Click Kutools > Select > Select Same & Different Cells.

1. In the Select Same & Different Cells dialog box, do the following operations:

(1.) Click the first button to select the source column to be compared, then click the second button to select the column you are compared with;

(2.) Choose Each row under the Based on section;

(3.) Then select Same Values fromt he Find section;

(4.) At last, you can choose one background or font color to highlight the same cells under the Processing of resuts section as you need.

2. Then click OK, and the same values both in column A and column B have been selected in column A.

With this utility, you can also find the different values between two columns.

Notes:

• My data has headers: If the data you are compared has headers, you can check this option, and the headers will not be compared.
• Select entire rows: With this option, the entire rows which contain the same values will be selected.
• Case Sensitive: Checking this option, you will compare the columns with case sensitive.
• The two comparing ranges must contain the same number of columns.
• If you want to select the duplicates from column C, you just need to swap the two selected columns.

#### Quickly find duplicate values in one column with Kutools for Excel

After installing Kutools for Excel, please do as below:

Sometimes, you may want to find the duplicate values in a column, the Kutools for Excel also can help you quickly handle it.

1. Select the column you want to find duplicate values, click Kutools > Select > Select Duplicate & Unique Cells.

2. In the Select Duplicate & Unique Cells dialog, check Duplicates or All duplicates option as you need, and at the same time, you can decide to highlight the duplicates with background or font color or not in Processing of results section.

3. Click Ok, a dialog pops out to remind you the number of selected duplicate cells, click OK to close it, and the duplicates are selected and highlighted.

Related Article:

How to find unique values between two columns in excel?

### Recommended Productivity Tools

#### Office Tab

Bring handy tabs to Excel and other Office software, just like Chrome, Firefox and new Internet Explorer.

#### Kutools for Excel

Amazing! Increase your productivity in 5 minutes. Don't need any special skills, save two hours every day!

300 New Features for Excel, Make Excel Much Easy and Powerful:

• Merge Cell/Rows/Columns without Losing Data.
• Combine and Consolidate Multiple Sheets and Workbooks.
• Compare Ranges, Copy Multiple Ranges, Convert Text to Date, Unit and Currency Conversion.
• Count by Colors, Paging Subtotals, Advanced Sort and Super Filter,

Say something here...
symbols left.
###### or post as a guest, but your post won't be published automatically.
• To post as a guest, your comment is unpublished.
· 11 months ago
so lovely yeah!
• To post as a guest, your comment is unpublished.
· 1 years ago
I LOVE THIS SITE!
• To post as a guest, your comment is unpublished.
· 1 years ago
Thank You!
• To post as a guest, your comment is unpublished.
· 1 years ago
This shit don't work... just getting

outRng.Select object variable or with block variable not set??
• To post as a guest, your comment is unpublished.
· 1 years ago
great demo guys,keep rocking