I have an array, which is the result of the multiplication of two COUNTIF functions.
The result is {0,2,7,4,0}. I want to count the number of non-zero elements. I tried the following:
=COUNTIF(COUNTIF*COUNTIF,">0") <- here the two inner COUNTIFs are short for the complete formula
It did not work. I then tried the following, which did not work either.
=COUNTIF({0,2,7,4,0},">0")
I resorted to using the following array formula and it worked.
{=SUM(IF(COUNTIF*COUNTIF>0,1,0))}
Two questions:
- does COUNTIF only accept cell reference but not constant array?
- any solution other than array formula?
Thanks.
=sumproduct(--((COUNTIF*COUNTIF)>0))
work? sumproduct provides one level of the cyclic calculation of an array formula. – user4039065