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:
Best Office Productivity Tools
Supports Office/Excel 2007-2021 and 365 | Available in 44 Languages | Easy to Uninstall Completely
Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need Is Just A Click Away...
Supercharge Your Excel Skills: Experience Efficiency Like Never Before with Kutools for Excel (Full-Featured 30-Day Free Trial)
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! (Full-Featured 30-Day Free Trial)