For convenience, the range B5:B15 isnameddata.
This problem can be solved with the COUNTIF function or the SUMPRODUCT function.
Both methods are explained below.
COUNTIF function
TheCOUNT functioncounts the number of cells in a range that meet supplied criteria.
Note that cell B9 is excluded since it is equal to zero.
Also notice that we supply thecriteriain double quotes (">0").
COUNTIF is part of agroup of Excel functionsthat split logical expressions into two parts.