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.

Excel formula: Count cells that contain positive numbers

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.

Excel formula: Count cells that contain negative numbers

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.

Excel formula: Count cells that contain errors

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.

Excel formula: Count cells that contain text

Excel COUNT function

Excel SUMPRODUCT function

Excel ISNUMBER function