0

我正在尝试减少公式,但我真的不明白如何使用 SUMPRODUCT 函数。我是一个新的excel用户,正在一步一步地做事。

我试过使用 SUM 和 SUMIFS 函数,但它使公式变得很长,并且文件在读取所做的更改时很慢。

SUMIFS(OFFSET(INDEX('DAILY SALES'!$B:$B,MATCH(O$2,'DAILY SALES'!$B:$B,0)),2,7,15,1),OFFSET(INDEX('DAILY SALES'!$B:$B,MATCH(O$2,'DAILY SALES'!$B:$B,0)),2,5,15,1),$B5,OFFSET(INDEX('DAILY SALES'!$B:$B,MATCH(O$2,'DAILY SALES'!$B:$B,0)),2,6,15,1),DATA!$D$2),SUMIFS(OFFSET(INDEX('DAILY SALES'!$B:$B,MATCH(O$2,'DAILY SALES'!$B:$B,0)),2,12,15,1),OFFSET(INDEX('DAILY SALES'!$B:$B,MATCH(O$2,'DAILY SALES'!$B:$B,0)),2,10,15,1),$B5, OFFSET(INDEX('DAILY SALES'!$B:$B,MATCH(O$2,'DAILY SALES'!$B:$B,0)),2,11,15,1),DATA!$F$2),SUMIFS(OFFSET(INDEX('DAILY SALES'!$B:$B,MATCH(O$2,'DAILY SALES'!$B:$B,0)),2,18,15,1), OFFSET(INDEX('DAILY SALES'!$B:$B,MATCH(O$2,'DAILY SALES'!$B:$B,0)),2,16,15,1),$B5,OFFSET(INDEX('DAILY SALES'!$B:$B,MATCH(O$2,'DAILY SALES'!$B:$B,0)),2,17,15,1),DATA!$F$2),SUMIFS(OFFSET(INDEX('DAILY SALES'!$B:$B,MATCH(O$2,'DAILY SALES'!$B:$B,0)),2,23,15,1),OFFSET(INDEX('DAILY SALES'!$B:$B,MATCH(O$2,'DAILY SALES'!$B:$B,0)),2,21,15,1),$B5,OFFSET(INDEX('DAILY SALES'!$B:$B,MATCH(O$2,'DAILY SALES'!$B:$B,0)),2,22,15,1),DATA!$H$2))

我希望输出至少是我给定公式的 1/2,或者如果可能的话,更少。先感谢您。

1这是记录销售额的地方
2当记录每日销售额时,它会自动从库存中扣除


有代码的是 SOLD 列。零售、返利和 25% 的 QTY 栏的总和是被扣除的。

我设法减少了公式,但仍在努力减少它,这里是:

=IF(INDEX('DAILY SALES'!$B:$B,MATCH(O$2,'DAILY SALES'!$B:$B,0)),SUM( SUMPRODUCT(--(OFFSET(INDEX('DAILY SALES'!$B:$B,MATCH(O$2,'DAILY SALES'!$B:$B,0)),2,5,15,1)=$B5),--(OFFSET(INDEX('DAILY SALES'!$B:$B,MATCH(O$2,'DAILY SALES'!$B:$B,0)),2,6,15,1)=DATA!$D$2),OFFSET(INDEX('DAILY SALES'!$B:$B,MATCH(O$2,'DAILY SALES'!$B:$B,0)),2,7,15,1)), SUMPRODUCT(--(OFFSET(INDEX('DAILY SALES'!$B:$B,MATCH(O$2,'DAILY SALES'!$B:$B,0)),2,10,15,1)=$B5),--(OFFSET(INDEX('DAILY SALES'!$B:$B,MATCH(O$2,'DAILY SALES'!$B:$B,0)),2,11,15,1)=DATA!$F$2),OFFSET(INDEX('DAILY SALES'!$B:$B,MATCH(O$2,'DAILY SALES'!$B:$B,0)),2,12,15,1)), SUMPRODUCT(--(OFFSET(INDEX('DAILY SALES'!$B:$B,MATCH(O$2,'DAILY SALES'!$B:$B,0)),2,16,15,1)=$B5),--(OFFSET(INDEX('DAILY SALES'!$B:$B,MATCH(O$2,'DAILY SALES'!$B:$B,0)),2,17,15,1)=DATA!$F$2),OFFSET(INDEX('DAILY SALES'!$B:$B,MATCH(O$2,'DAILY SALES'!$B:$B,0)),2,18,15,1))))

4

1 回答 1

0

=IF(INDEX('DAILY SALES'!$B:$B,MATCH(O$2,'DAILY SALES'!$B:$B,0)), SUMPRODUCT(--('DAILY SALES'!G4:G18=$B5),--('DAILY SALES'!H4:H18=DATA!$D$2),'DAILY SALES'!I4:I18)+ SUMPRODUCT(--('DAILY SALES'!L4:L18=$B5),--('DAILY SALES'!M4:M18=DATA!$F$2),'DAILY SALES'!N4:N18)+ SUMPRODUCT(--('DAILY SALES'!R4:R18=$B5),--('DAILY SALES'!S4:S18=DATA!$F$2),'DAILY SALES'!T4:T18)+ SUMPRODUCT(--('DAILY SALES'!W4:W18=$B5),--('DAILY SALES'!X4:X18=DATA!$H$2),'DAILY SALES'!Y4:Y18))

这是我能得到的最短时间,但是,我失去了将所有内容扩展到一年中最后一天的功能。

于 2019-03-27T09:38:46.983 回答