You are going to need VBA then.
Hit ALT+F11 and then go to Insert|Module and paste the below code in the 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
close the VB editor
Then in E10 of the spreadsheet enter formula:
=SUBSTITUTE(TRIM(aconcat(IF($A$2:$A$7=$D10&";"&E$9,$B$2:$B$7,"")," "))," ",", ")
adjust the ranges to suit your data and then hold the CTRL+SHIFT keys down and hit ENTER, then copy across the columns.
You will need to widen the columns to see all matches.
Bookmarks