=TEXTJOIN(",",1,UNIQUE(SUBSTITUTE(LEFT(TEXTSPLIT(CONCAT(B2:B5),,"箱"),MMULT(IFERROR(FIND({"水","膜"},TEXTSPLIT(CONCAT(B2:B5),,"箱")),),{1;1})),"、",))&TEXT(MMULT(IF(IFERROR(FIND(UNIQUE(SUBSTITUTE(LEFT(TEXTSPLIT(CONCAT(B2:B5),,"箱"),MMULT(IFERROR(FIND({"水","膜"},TEXTSPLIT(CONCAT(B2:B5),,"箱")),),{1;1})),"、",)),"|"&TEXTSPLIT(CONCAT(B2:B5),"箱"))-1,),IFERROR(MID(TEXTSPLIT(CONCAT(B2:B5),"箱"),MMULT({1,1},IFERROR(FIND({"水";"膜"},TEXTSPLIT(CONCAT(B2:B5),"箱"))+1,)),9),)/1,0),1^ROW(INDIRECT("1:"&LEN(CONCAT(B2:B5))-LEN(SUBSTITUTE(CONCAT(B2:B5),"、",))+COUNTA(A2:A5)+1))),"0箱;;"))
=TEXTJOIN(",",1,UNIQUE(SUBSTITUTE(LEFT(TEXTSPLIT(CONCAT(IF(A$2:A$5=A9,B$2:B$5,"")),,"箱"),MMULT(IFERROR(FIND({"水","膜"},TEXTSPLIT(CONCAT(IF(A$2:A$5=A9,B$2:B$5,"")),,"箱")),),{1;1})),"、",))&TEXT(MMULT(IF(IFERROR(FIND(UNIQUE(SUBSTITUTE(LEFT(TEXTSPLIT(CONCAT(IF(A$2:A$5=A9,B$2:B$5,"")),,"箱"),MMULT(IFERROR(FIND({"水","膜"},TEXTSPLIT(CONCAT(IF(A$2:A$5=A9,B$2:B$5,"")),,"箱")),),{1;1})),"、",)),"|"&TEXTSPLIT(CONCAT(IF(A$2:A$5=A9,B$2:B$5,"")),"箱"))-1,),IFERROR(MID(TEXTSPLIT(CONCAT(IF(A$2:A$5=A9,B$2:B$5,"")),"箱"),MMULT({1,1},IFERROR(FIND({"水";"膜"},TEXTSPLIT(CONCAT(IF(A$2:A$5=A9,B$2:B$5,"")),"箱"))+1,)),9),)/1,0),1^ROW(INDIRECT("1:"&LEN(CONCAT(IF(A$2:A$5=A9,B$2:B$5,"")))-LEN(SUBSTITUTE(CONCAT(IF(A$2:A$5=A9,B$2:B$5,"")),"、",))+COUNTIF(A$2:A$5,A9)+1))),"0箱;;"))
|