我有一个包含多个名为1,2,3 ... 31的工作表的excel文件(代表一个月中的天数)。您在下面看到的表格在每一页上,但是具有不同的值。
RDC 1 5000
RDC 2 0
CAPS 0
TILT 0
FOAM 12500
我想计算每个选项的正值。因此,如果CAPS中有20张正值,则应返回“ 20”。对于最后3个选项,我没有问题。我使用了forumla:
= SUMPRODUCT(COUNTIF(INDIRECT(“'”&A2:A32&“'!B3”);“> 0”))
但是前两个选项我想将它们视为一个。因此,如果:
在第1天,RDC1的值为正,RDC2的值为0,因此应计为1
在第2天,RDC1和RDC2都为正值,因此它也应计为1,而不是2
I have tried using the formula (and formatting the total count cell to Number with no decimals, so when it's 0.5 it should return 1 )
=SUM(IF('1'!B1>0;1;0);IF('1'!B2>0;1;0))/2 + ... for all days ... + SUM(IF('31'!B1>0;1;0);IF('31'!B2>0;1;0))/2
It's working with fewer sheets, but when I write the formula for all the sheets it returns an error. And yeah... it's a very long formula.
Can anyone help me with a solution to count the positive values together for the first two options as described above?
Instead of COUNTIF
you can use COUNTIFS
:
=COUNTA(A2:A32)-SUMPRODUCT(COUNTIFS(INDIRECT("'"&A2:A32&"'!B1");"=0";INDIRECT("'"&A2:A32&"'!B2");"=0"))
请注意,COUNTIF
该操作执行AND操作,因此,如果您想在B1或B2> 0时进行计数,则只需在两者均等于0时进行计数,然后从总数中减去该数字即可。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句