How to compare two columns and delete matches in Excel?
If you have two columns/lists including some duplicates, now you want to compare them and find out the matches, the delete them, how can you quickly solve? In this article, I introduce different ways to help you handle it in Excel.
In Excel, I introduce formulas to help you find out the match ones.
1. Select a blank cell next to the first column you want to compare (Name1), here I select B1, and type this formula =IF(ISERROR(MATCH(A1,$C$1:$C$10000,0)),"Unique","Duplicate"), and press Enter key, and drag the autofill handle down to fill this formula to the cells. See screenshot:
Note: in the formula, A1 is the first cell of your first column which you need to compare and C1:C10000 is the column you want to compare with.
2. Then select the formula columns, and click Data > Filter. See screenshot:
3. Click at the arrow in the first cell of helper column, and check Duplicate only from the drop down list. See screenshot:
4. Click OK. Now only the duplicates are visible, select them in the Name1 column, and press Delete key in the keyboard to delete them.
5. Click Data > Filter again to remove the filter, and then remove the formulas if you do not need it any more.
Now all the matches of two compared columns are deleted.
With above method is somewhat troublesome, and you can use Kutools for Excel’s Compare Ranges function to quickly select the matches in two columns and then delete them.
|Kutools for Excel, with more than 300 handy functions, makes your jobs more easier.|
After free installing Kutools for Excel, please do as below:
1. Select the two ranges that you want to compare by holding Ctrl key, then click Kutools > Select > Select Same & Different Cells. See screenshot:
2. In the Select Same & Different Cells dialog, Check My Data has headers if your selection contians headers (the selected headers must be same if you check this option), and the check Each row and Same Values option. See screenshot:
3. Click Ok, a dialog pops out to tell you the number of selected cells.
4. Click OK to close the dialogs, and the match ones in first column are selected, and press Delete key to delete them.
If you want to highlight the same values between two columns, you can check Fill backcolor or Fill font color option and select a color you want from the list.
You may be interested in these articles:
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
- To post as a guest, your comment is unpublished.· 1 months agoThis is not working for numerical columns
- To post as a guest, your comment is unpublished.· 10 months agoI tried but it gives an error :( But thanx
- To post as a guest, your comment is unpublished.· 6 months agoHi, if the formula get error, you can check if the reference is wrong, or you can try the second method above.