借用2楼公式,拉个火车,需要WPS最新版。如果不支持新函数,一是升级版本,二是采用VBA。
No.1:
- =LET(name,UNIQUE(DROP(TEXTSPLIT(CONCAT(REGEXP(CONCAT($D$2:$D$5),"(?<=总部).+")),,{":","、"}),1),FALSE),re,REDUCE(F1:I1,name,LAMBDA(x,y,VSTACK(x,IFNA(HSTACK(y,DROP(REDUCE(G1:I1,A2:A5,LAMBDA(m,n,VSTACK(m,IF(ISNUMBER(FIND(y,OFFSET(n,,3))),HSTACK(n,OFFSET(n,,2),OFFSET(n,,1))),""))),1)),"")))),res,FILTER(re,TAKE(re,,-1)<>""),res)
复制代码
NO.2:
- =LET(name,UNIQUE(DROP(TEXTSPLIT(CONCAT(REGEXP(CONCAT($D$2:$D$5),"(?<=总部).+")),,{":","、"}),1),FALSE),re,REDUCE(F1:I1,name,LAMBDA(x,y,VSTACK(x,IFNA(HSTACK(y,DROP(REDUCE(G1:I1,A2:A5,LAMBDA(m,n,VSTACK(m,IF(ISNUMBER(FIND(y,OFFSET(n,,3))),HSTACK(n,OFFSET(n,,2),OFFSET(n,,1))),""))),1)),y)))),res,FILTER(re,(CHOOSECOLS(re,2)<>"")*(CHOOSECOLS(re,2)<>FALSE)),res)
复制代码
|