出货数据
出货清单
如图根据出货数据制作出货清单,清单根据客户名称逐一制作,并按月进行月度小计。包含内容的位置与出货数据不尽相同,公式如下:
=IFERROR(REDUCE("",UNIQUE(出货!C2:C218),LAMBDA(m,n,LET(
title,HSTACK("客户:",n," ","联系人:"," "," ","电话: "," ","对帐单号",n),
data,REDUCE({"日期","货 号","名 称","规 格","数量","单价","金额","单号","每单金额","收款金额"},UNIQUE(MONTH(出货!B8:B69)),LAMBDA(x,y,LET(
fil,FILTER(HSTACK(出货!B2:B218,出货!D2:D218,出货!E2:K218,出货!O2:O218),(MONTH(出货!B2:B218)=y)*(出货!C2:C218=n),""),
VSTACK(x,fil,HSTACK("","","本月合计","",IFERROR(SUM(INDEX(fil,,5)),0),"",IFERROR(SUM(INDEX(fil,,7)),0)))))),
VSTACK(m,VSTACK(HSTACK("","","","出货清单"),"",title,data,HSTACK("","","累计","",IFERROR(SUM(INDEX(data,,5))/2,0),"",IFERROR(SUM(INDEX(data,,7))/2,0))))))),"")
公式思路:这是一个典型的通过lambda系列新函数一键形成新表格的例子,这在以前的excel中是不可能实现的。
公式主体为reduce(vstack……
表格结构的构造就是由vstack和hstack构成的:
VSTACK(m,VSTACK(HSTACK("","","","出货清单"),"",title,data,HSTACK("","","累计","",IFERROR(SUM(INDEX(data,,5))/2,0),"",IFERROR(SUM(INDEX(data,,7))/2,0)))))
VSTACK竖向堆叠的数据有:
1、m:reduce公式的累积结果;
2、VSTACK(HSTACK("","","","出货清单"):标题栏并通过空格达到居中的效果;
3、"":空格,起到将标题栏与内容部分进行行距调整的作用;
4、title:由客户名称、编号、时间等构成的一行数据;
5、data:由出货数据构成的二维表格;
6、HSTACK("","","累计","",IFERROR(SUM(INDEX(data,,5))/2,0),"",IFERROR(SUM(INDEX(data,,7))/2,0)):由累计、各项求和构成的一列数据,实现整体累计。
通过这6个数据的纵向堆叠就行成了所需要的出货清单。
评论 (0)