本帖最后由 edwin11891 于 2024-8-18 22:15 编辑
如果没有GROUPBY函数,或是WPS(新版):
- =MAP(B2:B6,D2:D6,LAMBDA(xx,yy,LET(sa,TEXTSPLIT(xx&CHAR(10)&yy,,CHAR(10)),sb,LEFT(sa,10),se,UNIQUE(sb),sf,REDUCE("",se,LAMBDA(x,y,VSTACK(x,IF(ROWS(FILTER(sb,sb=y))>1,y&"工奖",FILTER(sa,sb=y))))),sg,TEXTJOIN(CHAR(10),,sf),sg)))
复制代码
如果是M365,有GROUPBY函数的情况下:
- =MAP(B2:B6,D2:D6,LAMBDA(x,y,LET(a,x&CHAR(10)&y,b,TEXTSPLIT(a,,CHAR(10)),c,HSTACK(LEFT(b,10),RIGHT(b,2)),d,GROUPBY(TAKE(c,,1),TAKE(c,,-1),ARRAYTOTEXT,0,0),e,SUBSTITUTE(TAKE(d,,1)&TAKE(d,,-1),"工资, 奖金","工奖"),f,TEXTJOIN(CHAR(10),,e),f)))
复制代码
|