This problem can be solved with the COUNT function or the SUMPRODUCT function.
Both methods are explained below.
COUNT function
TheCOUNT functioncounts the number of cells in a range that contain numeric values.
Cell B9 is not included because it is empty.
Cells B11 and B12 are not included because they containtext values.
Note: theCOUNTA functioncounts numbers and text, but does not count empty cells.
The main reason is flexibility and extensibility.
SUMPRODUCT can easily perform calculations that the COUNT function, or even COUNTIF or COUNTIFS simply can’t perform.
One example is the formula below, which adds the NOT function to reverse behavior.
Another basic exampleis this formula, which uses the ISODD function to count odd numbers.
Numbers include negative numbers, percentages, dates, times, fractions, and formulas that return numbers.