Ok try this:
add this User-Defined Function (Alt+F11, Insert|Module and paste in VB Editor)
Function aconcat(a As Variant, Optional sep As String = "") As String
' Harlan Grove, Mar 2002
Dim y As Variant
If TypeOf a Is Range Then
For Each y In a.Cells
aconcat = aconcat & y.Value & sep
Next y
ElseIf IsArray(a) Then
For Each y In a
aconcat = aconcat & y & sep
Next y
Else
aconcat = aconcat & a & sep
End If
aconcat = Left(aconcat, Len(aconcat) - Len(sep))
End Function
Then back in spreadsheet, in E2 enter formula:
=SUBSTITUTE(TRIM(aconcat(TRANSPOSE(IF(ISNUMBER(SEARCH(D2,Table1!$C$2:$Z$290)),Table1!$A$2:$A$290&"-"&Table1!$B$2:$B$290,""))," "))," ",", ")
confirmed with CTRL+SHIFT+ENTER not just ENTER and copy down.
Note: This will take a minute or two to calculate....
Bookmarks