Pictures of excel sheets aren't much use... non editable. An excel sheet is strongly preferred. But... here's one i made earlier.
In C2, copied down:
=IFERROR(INDEX($A$2:$A$4,MATCH(0,INDEX(--(COUNTIF($C$1:C1,$A$2:$A$4)=LEN(B$2:B$4)-LEN(SUBSTITUTE(B$2:B$4,",",""))+1),0),0)),"")
In D2, copied down:
=IF(C2="","",TRIM(MID(SUBSTITUTE(","&VLOOKUP(C2,A$2:B$4,2,0),",",REPT(" ",99)),COUNTIF(C$2:C2,C2)*99,99)))
Bookmarks