学习了,就要记笔记,笔记 链接:
告别手动盘点:SCAN加REUDCE函数自动化公式精准预测缺货时间
整体思路:
方法1:填充公式
- =LET(_a,FILTER(C$2:D$18,B$2:B$18=F2),_b,SCAN(0,INDEX(_a,,2),SUM),_c,MATCH(1=1,_b-G2>0,),IFNA(INDEX(_a,_c,1),""))
复制代码 方法2:填充公式
- =XLOOKUP(0,SCAN(G2,FILTER($D$2:$D$18,$B$2:$B$18=F2),LAMBDA(x,y,x-y)),FILTER($C$2:$C$18,$B$2:$B$18=F2),"",-1)
复制代码 方法3:数组公式
- =DROP(REDUCE("",F2:F9,LAMBDA(m,n,LET(a,FILTER(C2:D18,B2:B18=n),b,MAP(SEQUENCE(ROWS(a)),LAMBDA(x,SUM(TAKE(TAKE(a,,-1),x)))),VSTACK(m,TAKE(FILTER(TAKE(a,,1),VLOOKUP(n,F2:G9,2,)-b<0,""),1))))),1)
复制代码 方法4:填充公式
- =XLOOKUP(1=1,SUMIFS(D:D,B:B,F2,C:C,"<="&C$2:C18)>G2,C$2:C18,"",0)
复制代码 方法5:数组公式
- =DROP(REDUCE("",F2:F9,LAMBDA(m,n,LET(a,FILTER(C2:D18,B2:B18=n),b,SCAN(0,TAKE(a,,-1),SUM),VSTACK(m,XLOOKUP(1=1,VLOOKUP(n,F2:G9,2,)-b<0,TAKE(a,,1),""))))),1)
复制代码
|