答案1
答案2
使用 SUBSTITUTE 创建类似 XML 的字符串。然后使用 FILTERXML 返回其中一个单元格中的部分数组。在另一个单元格中使用该数组进行 SEARCH。最后将找到的值返回给 TEXTJOIN:
=TEXTJOIN(", ",TRUE,IF(ISNUMBER(SEARCH(","&TRIM(FILTERXML("<z><y>" & SUBSTITUTE(B2,",","</y><y>")&"</y></z>","//y"))&",",","&SUBSTITUTE(A2," ","")&",")),TRIM(FILTERXML("<z><y>" & SUBSTITUTE(B2,",","</y><y>")&"</y></z>","//y")),""))