where data is the named range B5:B15. The result is 3, since there are three cells in B5:B15 that contain numbers less than zero.

COUNTIF function

The COUNT function counts the number of cells in a range that match the supplied criteria. For example, you can use COUNTIF like this: To count negative numbers in this example, we need to use the less than operator (<) with zero like this: To include zero in the count, use the less than or equal to operator (>=): Notice that the criteria is enclosed in double quotes (""). COUNTIFS is in a group of eight functions that share this syntax.


Another way to solve this problem is with the SUMPRODUCT function and Boolean algebra: Working from the inside out, this expression checks if values in data (B5:B15) are less than zero: Because data contains eleven cells, the result from this expression is an array that contains 11 TRUE and FALSE values: To convert the TRUE and FALSE values to 1s and 0s, we use a double negative (–): The resulting array inside the SUMPRODUCT function looks like this: With a single array to process, SUMPRODUCT sums the array and returns 3 as the result.

Dave Bruns

Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.