本帖最后由 tmplinshi 于 2024-3-14 16:03 编辑
- =LET(fn,LAMBDA(self,arr,[i],[preId],[out],LET(i,i+1,id,INDEX(arr,i,1),s,INDEX(arr,i,2),append,IF(id=preId,","&s,";"&id&","&s),out,out&append,IF(i<ROWS(arr),self(self,arr,i,id,out),out))),str,fn(fn,A2:B11),TEXTSPLIT(REPLACE(str,1,1,),",",";",,,""))
复制代码
- =LET(fn,LAMBDA(self,arr,i,preId,group,out,LET(i,i+1,id,INDEX(arr,i,1),s,INDEX(arr,i,2),out,IF(id=preId,out,VSTACK(out,group)),group,IF(id=preId,HSTACK(group,s),INDEX(arr,i,)),IF(i<ROWS(arr),self(self,arr,i,id,group,out),VSTACK(out,group)))),DROP(IFNA(fn(fn,A2:B11,0,"","",""),""),2))
复制代码
|