Can Index and Match function be combined to assign values separated in value column by comma and variable column by carriage return (Char(10))? See below as an example
formula =IF(ISNA(MATCH($E$1,$B2:$B4,0)),"",INDEX($A2:$B4,MATCH($E$1,$B2:$B4,0),1))