使用单元格引用在Excel中进行SUMPRODUCT

时间:2014-07-09 22:10:43

标签: excel-formula excel-2010

我有这个相当不优雅的excel 2010公式来计算在一定范围内发生的实例数(在这种情况下为1到5天),但是它有效:

=SUMPRODUCT(1*('Defect List'!$D$2:$D$999="Closed")*
(NETWORKDAYS('Defect List'!$C$2:$C$999+0,'Defect List'!$J$2:$J$999+0)>=1)) 
- SUMPRODUCT(1*
(NETWORKDAYS('Defect List'!$C$2:$C$999+0,'Defect List'!$J$2:$J$999+0)>5)
)

问:现在我想通过用单元格M3和N3替换1和5来进行参数化。但我似乎无法正确理解语法 - 有人可以帮忙吗?

1 个答案:

答案 0 :(得分:2)

公式中的*会抛出错误,请用逗号替换它,如下所示:

=SUMPRODUCT(1*('Defect List'!$D$2:$D$999="Closed"),
            1*(NETWORKDAYS('Defect List'!$C$2:$C$999+0,
                           'Defect List'!$J$2:$J$999+0)>=M3),
            1*(NETWORKDAYS('Defect List'!$C$2:$C$999+0,
                           'Defect List'!$J$2:$J$999+0)<=N3))

你可以在一个sumproduct中完成所有操作,但是COUNTIFS是一个更好的解决方案,如果你将NETWORKDAYS放入缺陷列表中的一列,比如AZ:

=COUNTIFS('Defect List'!$D$2:$D$999,"Closed",
          'Defect List'!$AZ$2:$AZ$999,">="&$M$3,
          'Defect List'!$AZ$2:$AZ$999,"<="&$N$3)

这意味着excel不必为每个单元格重新计算每个NETWORKDAYS