使用多个SUMIF简化Excel公式
我有一份工作手册,分别是2009财年,2010财年和2011财年的三个工作表。 我需要计算具有以下状态之一的条目(列D):完成,取消。 以下是该函数目前的样子:
=COUNTIFS('FY11'!D:D,"Complete",'FY11'!F:F,">="&D3,'FY11'!F:F,"<="&F3)+COUNTIFS('FY11'!D:D,"Cancelled",'FY11'!F:F,">="&D3,'FY11'!F:F,"<="&F3) + COUNTIFS('FY10'!D:D,"Complete",'FY10'!F:F,">="&D3,'FY10'!F:F,"<="&F3)+COUNTIFS('FY10'!D:D,"Cancelled",'FY10'!F:F,">="&D3,'FY10'!F:F,"<="&F3) + =COUNTIFS('FY09'!D:D,"Complete",'FY09'!F:F,">="&D3,'FY09'!F:F,"<="&F3)+COUNTIFS('FY09'!D:D,"Cancelled",'FY09'!F:F,">="&D3,'FY09'!F:F,"<="&F3)
为什么我不能使用这样的东西:
=COUNTIF('FY10'!D:D,{"Complete","Cancelled"})
只比你的伪示例复杂一点,但是这与Excel允许的一样简单:
=SUM(COUNTIFS('FY10'!D:D,{"Complete","Cancelled"}))
你可以使用一个数组公式来简化它,遗憾的是我不认为它像你想要的那样简单…
这是发生在我身上你可以做…
=SUM(IF(D:D="Cancelled",1,IF(D:D="Complete",1)))
remmeber用ctrl + shift +回车进入公式