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

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

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:

#### 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 30 days!

Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 30 days.

#### 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 Downloadfree full-featured in 30 days

After 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?

### The Best Office Productivity Tools

#### Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

• Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
• Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
• Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
• Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
• Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
• Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
• Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
• Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
• More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial. 60-day money back guarantee.

#### Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

• Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
• Open and create multiple documents in new tabs of the same window, rather than in new windows.
• Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
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.
· 1 months ago
BUT I WANT DUPLICATE VALUE BEFORE ANY SPACING, IN COLUMN B WE FOUND DUPLICATE VALUES THAT'S GREAT BUT THERE IS SPACE I WANT THOSE VALUES WITHOUT SPACES, HOW CAN I?
• To post as a guest, your comment is unpublished.
· 23 days ago
Hi, just remove the spaces by using the Go to special function to find the space cell, then remove them by clicking Delete key after finding the duplicate values.
• To post as a guest, your comment is unpublished.
· 10 months ago
Здравствуйте. Макрос приведенный здесь выделяет дубликаты ячеек, но при попытке редактирования какой-либо ячейки выделение снимается сразу со всех дубликатов, как сделать что бы этого не происходило?
• To post as a guest, your comment is unpublished.
· 2 years ago
so lovely yeah!
• To post as a guest, your comment is unpublished.
· 2 years ago
I LOVE THIS SITE!
• To post as a guest, your comment is unpublished.
· 2 years ago
Thank You!
• To post as a guest, your comment is unpublished.
· 2 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.
· 3 years ago
great demo guys,keep rocking
• To post as a guest, your comment is unpublished.
· 3 years ago
Thank You Very Much Guys
• To post as a guest, your comment is unpublished.
· 3 years ago
that was really great.
• To post as a guest, your comment is unpublished.
· 3 years ago
its good...thnq u

..
• To post as a guest, your comment is unpublished.
· 3 years ago
We have two sheets. In one of theme, there are names and another one ,address. Some names do not have address. And the addresses and names are irregular. And only with the code We can link theme to each other. I want to do something that names and addresses sort by the code.
sorry for my ENGLISH
An example of sheets:
Sheet 1:
name code
2111 David

Second sheet:
st ... 2020
st6 2025
st .. 2111
• To post as a guest, your comment is unpublished.
· 3 years ago
Taher... Send me your Email ID. I can help you. What i understand that you have 2 sheets. One has names and some Code for each name and the second one has Addresses and Codes. The Code is the only column which can connect these 2 sheets. And you want all the names and their corresponding addresses to be displayed based on Codes.

Please send the same question to my email id vijkid143@gmail.com. I can send you the script and tell you the steps how it works.

Regards
Vijay
• To post as a guest, your comment is unpublished.
· 3 years ago
When copy =IF(ISERROR(MATCH(A2,\$C\$2:\$C\$13,0)),"",A2) make sure take off the full stop at the end or it will not work.
• To post as a guest, your comment is unpublished.
· 3 years ago
How to find common value in A1 : S1
• To post as a guest, your comment is unpublished.
· 3 years ago
HOW CAN I COMPAIR WHOL TWHO COLUMN TO FIND DUPLICAT VALUE
• To post as a guest, your comment is unpublished.
· 4 years ago
I'm trying to compare values on two columns on the same spreadsheet. Where there are duplicates, that is fine. However, where the values differ, I want the contents of one of the columns to be replaced with that of the other column. How do I go about that?

Thanks.
• To post as a guest, your comment is unpublished.
· 4 years ago
Hi, I need a bit of help. I tried the VBA method and received the following error message: "Compile error. Invalid outside procedure".

Any advice would be greatly appreciated, thanks
• To post as a guest, your comment is unpublished.
· 4 years ago
THANK YOU VERY MUCH.
• To post as a guest, your comment is unpublished.
· 4 years ago
Hello,
Is there any way to [u]match & pair [/u]duplicates in two separate columns? Example: There are 6 identical search items being searched for and only four identical amounts in the column being searched.
The match function finds the 1st duplicate in the column being searched and then returns the ordinal location of that 1st match position for each subsequent duplicate it finds in the search column.
Is there any way to identify duplicate matched items & define their distinct ordinal position with the column being searched.
This way if there are six duplicate search item amounts and only four duplicates found in the "Search Column" only the four items in the "Search Column" are matched and paired with the items searched.
I hope I have explained myself clearly and would like to thank you in advance for any help you may be able to offer on the subject.

Kind Regards,
RWF
• To post as a guest, your comment is unpublished.
· 4 years ago
How to Check Name Two Column with Duplicate?
• To post as a guest, your comment is unpublished.
· 4 years ago
Hello!
Does not work for Excel 2013! nor using fill down.
I used F2 and Enter,
• To post as a guest, your comment is unpublished.
· 4 years ago
Thank you very much.
• To post as a guest, your comment is unpublished.
· 4 years ago
In your first formula, is there a way to make the names in column C turn red if nothing in Column A matched?
• To post as a guest, your comment is unpublished.
· 4 years ago
i want some information regards, Excel Formula A Unique No and B amount c date d date, i want see that whenever i do applying formula pick unique no and calculation should on date C AND d column add value
• To post as a guest, your comment is unpublished.
· 5 years ago
Thanks a lot it saved my manual search time !!lot of time!!Copy & paste works but when i enter formula by myself it is not working any clue.
• To post as a guest, your comment is unpublished.
· 5 years ago
Hi
when you paste it paste it without any format or formula (paste as value)
• To post as a guest, your comment is unpublished.
· 5 years ago
greats WORK gUY greats WORK gUY
• To post as a guest, your comment is unpublished.
· 5 years ago
Hi,
This works only if the values are numeric... But does not if the value is alphabets or alpha numeric - Any other alternatively?
• To post as a guest, your comment is unpublished.
· 5 years ago
This article shows how to highlight duplicate values across a number of columns, however it is looking for duplicate values within each column. I was hoping to highlight cells when the value in the 1st cell in column 1, equals the value in the 1st cell in column 2, and the same all the way down. So if A5=B5 I want it to be highlighted, but not highlight if A5=B6, and not highlight if A5=A6. I hope that makes sense. Is there a way to do this?
• To post as a guest, your comment is unpublished.
· 5 years ago
I am trying to acknowledge the duplicates within 2 columns. Each column contains about 12000 account #'s and I have to determine which ones are duplicate from the previous year. Any ideas?
• To post as a guest, your comment is unpublished.
· 5 years ago
One of the best shortcuts available on the internet to compare two excel columns.
• To post as a guest, your comment is unpublished.
· 5 years ago
What is the meaning or purpose of dollar sign (\$)in excel?
• To post as a guest, your comment is unpublished.
· 5 years ago
Used Formula to find Duplicates in two Columns, worked fine, But now it will not. It acts as if both columns require same format? Didn't before. Please HELP,,,
• To post as a guest, your comment is unpublished.
· 5 years ago
I get a bunch of TRUE and FALSE, not the actual Number
• To post as a guest, your comment is unpublished.
· 5 years ago
Thaanks a lot..it worked!!!
Initially it didn't work for me. I followed Stby 's suggestion and it worked..
• To post as a guest, your comment is unpublished.
· 5 years ago
Sadly, this didn't work for me. I have literally copied and pasted the formula, so I don't know why it didn't work.

I have experimented with making my data text, numbers, or general.

All I get is the formula displayed. The formula actually isn't performing its function.
• To post as a guest, your comment is unpublished.
· 3 years ago
You can also use the Match function.

Make sure to put your headers so you can also sort after
In column A you have 1 list and in column C your 2nd list
In B2 use Match(A:A,C:C,0) hit enter.. it won't work if your items aren't matching in what they are, like a number to a number thing
Then using your filter function uncheck everything except the N/A in the 2nd column and you will see what isn't in the 1st.. easily knowing what didn't have matches and what did. You can do it both ways so just reverse the C and A in the above formula and see what isn't in A that is in C.. It works great for really long lists, then you don't have to continually scroll for those with and without matches.
• To post as a guest, your comment is unpublished.
· 5 years ago
Suggestion to Ian - when copy/pasting from a website to Excel, first copy to Notebook and then to Excel. Sometimes the formatting of the text in the website is what is screwing it up, by sending it through Notebook first you are removing any and all formatting.
~Stby
• To post as a guest, your comment is unpublished.
· 5 years ago
I did this, but it still will not work. If I find a duplicate on my own and cut & paste that cell from column c to a. THEN the formula Shows me. ALL cells are Formatted the same. Why is it doing that?
• To post as a guest, your comment is unpublished.
· 5 years ago
It works perfect here. You might need to change the , to ; if you havent already done that :)
• To post as a guest, your comment is unpublished.
· 5 years ago
[quote name="Ian"]Sadly, this didn't work for me. I have literally copied and pasted the formula, so I don't know why it didn't work.

I have experimented with making my data text, numbers, or general.

All I get is the formula displayed. The formula actually isn't performing its function.[/quote]

Rename(F2) the cell and press enter again for the formula to register.

Note:remove the . at the end of the formula if there is an error
• To post as a guest, your comment is unpublished.
· 5 years ago
I had the same problem (only formula displaying) and F2 fixed it. Thanks, this is such a time saving and brilliant solution.
• To post as a guest, your comment is unpublished.
· 6 years ago
Saved me a lot of time. Great work.

Thanks a lot for your blog post.
• To post as a guest, your comment is unpublished.
· 6 years ago
YOU MAGNIFICENT NERD YOU! I've been looking all over and every other tutorial sucks or doesn't understand that this is what people are trying to do. THANK YOU SO MUCH! And Happy Halloween! Keep up the great work!
• To post as a guest, your comment is unpublished.
· 6 years ago
Great Work Guys!!!
Thanks for the help!!