再分享一个公式,此楼计算模具出入库状态的
- =IFERROR(TOROW(LET(ee,UNIQUE(LET(dd,LET(aa,IFERROR(LET(pp,IFERROR(LET(x,FILTER(辅助表!$E$2:$E$300,ISNUMBER(SEARCH("出库",辅助表!$E$2:$E$300))*ISNUMBER(SEARCH(TEXTAFTER(W7,"热封")&"-",辅助表!$E$2:$E$300))),y,FILTER(辅助表!$Q$2:$Q$300,ISNUMBER(SEARCH("出库",辅助表!$Q$2:$Q$300))*ISNUMBER(SEARCH(TEXTAFTER(W7,"热封")&"-",辅助表!$Q$2:$Q$300))),IFS(OR(ISNUMBER(SEARCH("1号",W7)),ISNUMBER(SEARCH("中试",W7))),x,OR(ISNUMBER(SEARCH("2号",W7)),ISNUMBER(SEARCH("3号",W7))),y)),""),UNIQUE(LEFT(pp,SEARCH("热封",pp)-2))),""),bb,IFERROR(LET(nn,LET(n,IFS(OR(LEFT(W7,1)="2",LEFT(W7,1)="3"),FILTER(入库明细!$E$11:$E$33300&"-"&入库明细!$F$11:$F$33300&入库明细!$G$11:$G$33300&"于"&TEXT(入库明细!$D$11:$D$33300,"yyyy/mm/dd")&"入库",(入库明细!$H$11:$H$33300&入库明细!$E$11:$E$33300="2#线"&TEXTAFTER(W7,"热封"))+(入库明细!$H$11:$H$33300&入库明细!$E$11:$E$33300="3#线"&TEXTAFTER(W7,"热封"))),OR(LEFT(W7,1)="1",LEFT(W7,1)="中"),FILTER(入库明细!$E$11:$E$33300&"-"&入库明细!$F$11:$F$33300&入库明细!$G$11:$G$33300&"于"&TEXT(入库明细!$D$11:$D$33300,"yyyy/mm/dd")&"入库",(入库明细!$H$11:$H$33300&入库明细!$E$11:$E$33300="1#线"&TEXTAFTER(W7,"热封")))),FILTER(n,ISNUMBER(SEARCH(TEXTAFTER(TEXTBEFORE(TAKE(n,-1),"入库"),"于"),n)))),TEXTJOIN("、",,UNIQUE(LEFT(nn,SEARCH("热封模",nn)-2)))&"于"&TEXTAFTER(TAKE(nn,-1),"于")),""),cc,IFS(OR(LEFT(W7,1)="2",LEFT(W7,1)="3"),FILTER(出库明细!$E$11:$E$33300&"-"&出库明细!$F$11:$F$33300&出库明细!$G$11:$G$33300&"于"&TEXT(出库明细!$D$11:$D$33300,"yyyy/mm/dd")&"出库",(出库明细!$H$11:$H$33300&出库明细!$E$11:$E$33300="2#线"&TEXTAFTER(W7,"热封"))+(出库明细!$H$11:$H$33300&出库明细!$E$11:$E$33300="3#线"&TEXTAFTER(W7,"热封"))),OR(LEFT(W7,1)="1",LEFT(W7,1)="中"),FILTER(出库明细!$E$11:$E$33300&"-"&出库明细!$F$11:$F$33300&出库明细!$G$11:$G$33300&"于"&TEXT(出库明细!$D$11:$D$33300,"yyyy/mm/dd")&"出库",(出库明细!$H$11:$H$33300&出库明细!$E$11:$E$33300="1#线"&TEXTAFTER(W7,"热封")))),a,XLOOKUP(UNIQUE(aa),LEFT(cc,SEARCH("热封",cc)-2),TEXTBEFORE(TEXTAFTER(cc,"于"),"出库"),"",0,-1),b,TEXTBEFORE(TEXTAFTER(bb,"于"),"入库"),c,TEXTBEFORE(TEXTAFTER(TAKE(cc,1),"于"),"出库"),IFS(TAKE(aa,1)<>"",aa&"于"&a&RIGHT(TAKE(cc,-1),2),AND(TAKE(aa,-1)="",bb<>""),bb,AND(TAKE(aa,1)="",bb=""),UNIQUE(SUBSTITUTE(REPLACE(cc,SEARCH("热封",cc)-1,4,""),"出库","报废")))),FILTER(dd,NOT(ISNA(dd))))),LET(o,RIGHT(ee,12),r,LEFT(ee,LEN(ee)-13),SCAN("",UNIQUE(o),LAMBDA(x,y,TEXTJOIN("、",1,IF(o=y,r,""))&"于"&y))))),"")
复制代码 |