我正在尝试简化公式,但是我真的不明白如何使用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 This is where sales are recorded
2 When daily sales are recorded it is automatically deducted in inventory
带有代码的是SOLD列。零售中的“数量”列的总和,回扣和25%被扣除。
我设法简化了公式,但仍在进一步简化公式,这里是:
=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))))
答案 0 :(得分: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))
这是我能得到的最短的时间,但是,我失去了将所有内容扩展到一年的最后一天的功能。