How to join texts in a column without duplicates in Excel?
Do you know how to join texts from a column into a cell without duplicates in Excel? And what if join texts in a column without duplicates based on specific cell value? This article provides methods to solve the problems.
Note: In the formula, “, ” is the separator of the combined texts; A2:A12 is the column cells you will join together. Please change them as you need.
Now the texts in specified column are joined without duplicates.
Join texts in a column without duplicates based on another cell value with VBA code
Sometimes, you may need join texts in a column without duplicates based on value in another cell, as below screenshot shown, you can get it down as follows.
1. In the worksheet contains the texts you will join, press the Alt + F11 keys to open the Microsoft Visual Basic for Applications window.
2. In the Microsoft Visual Basic for Applications window, click Insert > Module, and then copy the below VBA code into the Module code window.
VBA code: Join texts in a column without duplicates based on another cell value
'Updated by Extendoffice 20190924
Dim xRg As Range
Dim xArr As Variant
Dim xCell As Range
Dim xTxt As String
Dim I As Long
Dim xDic As Object
Dim xStr, xStrValue As String
Dim xB As Boolean
On Error Resume Next
xTxt = ActiveWindow.RangeSelection.Address
Set xRg = Application.InputBox("Please select the data range", "Kutools for Excel", xTxt, , , , , 8)
Set xRg = Application.Intersect(xRg, xRg.Worksheet.UsedRange)
If xRg Is Nothing Then Exit Sub
If xRg.Areas.Count > 1 Then
MsgBox "Does not support multiple selections", , "Kutools for Excel"
If xRg.Columns.Count <> 2 Then
MsgBox "There must be only two columns in the selected range", , "Kutools for Excel"
xArr = xRg
Set xDic = CreateObject("Scripting.Dictionary")
xDic.CompareMode = 1
For I = 1 To UBound(xArr)
If Not xDic.Exists(xArr(I, 1)) Then
xDic.Item(xArr(I, 1)) = xDic.Count + 1
xArr(xDic.Count, 1) = xArr(I, 1)
xArr(xDic.Count, 2) = xArr(I, 2)
xStrValue = xArr(I, 2)
xB = True
For Each xStr In Split(xArr(xDic.Item(xArr(I, 1)), 2), ",")
If xStr = xStrValue Then
xB = False
If xB Then
xArr(xDic.Item(xArr(I, 1)), 2) = xArr(xDic.Item(xArr(I, 1)), 2) & "," & xArr(I, 2)
Sheets.Add.Cells(1).Resize(xDic.Count, 2).Value = xArr
3. Press the F5 key to run the code. In the popping up Kutools for Excel dialog, select the range including both the values you will join texts based on and the texts you will join, and then click the OK button.
Then the unique values are extracted and their corresponding unique texts in another column are joined and placed in a new worksheet.
Easily join texts in a column based on another cell value with an amazing tool
Maybe you are not good at formula or VBA code. Here recommend the Advanced Combine Rows utility of Kutools for Excel for you. With this utility, you can easily join texts in a column based on value in another cell with only several clicks.
Note: As the utility will directly apply in the original range, please make a copy of the original data before applying the below operation.
1. Select the range (include the texts you will join and the value you will join texts based on), click Kutools > Content > Advanced Combine Rows. See screenshot:
2. In the Advanced Combine Rows dialog, please do as follows:
Select the column containing the values you will join texts based on, and click Primary Key;
Select the column containing the texts you will join into a cell, and click Combine > Comma;
If there are columns left, please specify conditions for them. In this case, I select the Sales column and select Calculate > Sum.
Click the OK button. See screenshot:
Then you can see all the texts in specified column are joined based on the key column. See screenshot:
If you want to have a free trial ( 30-day) of this utility, please click to download it, and then go to apply the operation according above steps.
Combine duplicate rows and sum the values in Excel In Excel, you may always meet this problem, when you have a range of data which contains some duplicate entries, and now you want to combine the duplicate data and sum the corresponding values in another column, how could you solve this problem? Try the methods in this article.
Concatenate cells keeping number/date formatting in Excel You may have noticed that when we apply the CONCATENATE function in Excel, the date format (2014-01-03) and number format such as currency format ($734.7), percentage format (48.9%), decimal places (24.5000), etc. are removed and show as general numbers in the concatenation results. In this article we come up with several workarounds to concatenate data with keeping date or number formatting in Excel.
Reverse the concatenate function in Excel As we all known, the Concatenate function in Excel can help us to combine multiple cells into one cell, but, sometimes, you want to do the opposite of Concatenate function, it means not combine cells, but split cell value into multiple separated cells. Methods in this article will help solve the problem.
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.