How to combine two lists without duplicates in Excel?
There are two lists in your worksheet, and some of values in the lists are duplicates, and you want to combine these two lists and just leave the unique values, as shown as the below screenshots, how can you do?
Combine lists without duplicates with Remove Duplicates in Excel
Combine lists without duplicates with VBA
Combine lists without duplicates with Kutools for Excel
Combine lists without duplicates with Remove Duplicates in Excel
To combine two lists and remove duplicate values in Excel, you can do as follow:
1. Copy one of the two lists and paste it to the bottom of the other list, see screenshot:
2. Select the list and click Data > Remove Duplicates, see screenshot:
3. In the Remove Duplicates dialog, if your column has no header, uncheck My data has headers, and then click OK. See screenshot:
4. Then a dialog displays on the screen to tell you the duplicates have been delete, click OK. See screenshot:
You can see the result:
Combine lists without duplicates with VBA
In Excel, a VBA also can help you combine the two lists without duplicates.
1. Hold ALT button and press F11 on the keyboard to open a Microsoft Visual Basic for Application window.
2. Click Insert > Module, and copy the VBA into the module.
VBA: Combine lists without duplicates
Sub FindUniques()
'Updateby20140313
Dim rng As Range
Dim InputRng As Range, OutRng As Range
xTitleId = "KutoolsforExcel"
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Range :", xTitleId, InputRng.Address, Type:=8)
Set OutRng = Application.InputBox("Out put to (single cell):", xTitleId, Type:=8)
Set dic = CreateObject("Scripting.Dictionary")
For j = 1 To InputRng.Columns.Count
For i = 1 To InputRng.Rows.Count
xValue = InputRng.Cells(i, j).Value
If xValue <> "" And Not dic.Exists(xValue) Then
OutRng.Value = xValue
dic(xValue) = ""
Set OutRng = OutRng.Offset(1, 0)
End If
Next
Next
End Sub
3. Click Run button or press F5 to run the VBA.
4. A dialog displayed on the screen, and you can select the range you want to combine. See screenshot:
5. Click OK, then another dialog popped up for you to select a cell to output the combined result. See screenshot:
6. Click OK. You can see the lists have been combined.
Tip: The result cannot reserve the cells formatting after running the above VBA.
Combine lists without duplicates with Kutools for Excel
With installed Kutools for Excel, you can use the Select duplicates & unique cells function to solve the problem that combine two list without duplicates.
Kutools for Excel includes more than 300 handy Excel tools. Free to try with no limitation in 30 days. Get it Now
1. Copy one of the two lists and paste it to the bottom of the other list, select the new list, then click Kutools > Select > Select duplicates & unique cells. See screenshot:
2. In the Select duplicates & unique cells dialog, check All uniques (Including 1st duplicates), click Ok.
3. Then a dialog pops up to tell you how many unique values have been selected, click OK and Cancel to close two dialogs. See screenshot:
4. And copy the selected unique values and paste them to a new column. See screenshot:
Click here to know more about Select duplicates & unique cells.
Relative Articles:
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
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!