You can use a UDF Concat Function and Unique items formula:
Function Concat_Unique(Lookup_Value As String, Lookup_Column As Range, Concat_column As Range)
Dim i As Single
Dim Unique As New Collection
Dim Value As Variant
Dim result As String
For i = 1 To Lookup_Column.Cells.Rows.Count
If Lookup_Value = Lookup_Column.Cells(i).Value Then
If Len(Concat_column.Cells(i)) > 0 Then
On Error Resume Next
Unique.Add Concat_column.Cells(i), CStr(Concat_column.Cells(i))
On Error GoTo 0
End If
End If
Next i
For Each Value In Unique
result = result & Value & ", "
Next Value
If Len(result) = 0 Then
Concat_Unique = ""
Else
Concat_Unique = Left(result, Len(result) - 2)
End If
End Function
=IFERROR(INDEX($A$2:$A$13,MATCH(0,INDEX(COUNTIF($D$1:D1,$A$2:$A$13),0,0),0)),"")
UDF Concat funtion form:
=Concat_Unique(D2,$A$2:$A$13,$B$2:$B$13)
EDIT: Forgot to read everything, The UDF part
Bookmarks