Although the COUNTIF and COUNTIFS functions can count values by a given condition, they won't work if you want to use the output in other functions. In this article, we're going to show you how to count cells in Excel by year.


=SUMPRODUCT( N( YEAR( date values ) = year value ) )


  1. Start with the =SUMPRODUCT( function
  2. Use the N function, or double minus (--) signs to convert Boolean values into ones and zeroes N(
  3. Enter the criteria range – criteria condition by date and year numbers YEAR($B$3:$B$12)=D3
  4. Type in )) to close the N and the SUMPRODUCT functions, and finish the formula


The SUMPRODUCT function’s ability to handle arrays without array formulas provides an advantage over the limitations of COUNTIF and COUNTIFS functions. The SUMPRODUCT can evaluate and return arrays from range – value conditions. We use this functionality to run the YEAR function with array of date values and to resolve criteria range – criteria pairs.


The SUMPRODUCT function can sum the values in its argument array if there is only one argument. However, conditional equations return Boolean values, and therefore need to be converted into numbers which are meaningful for the SUMPRODUCT function. We can do this in two ways:

  1. The N function
  2. Double minus (--)

The N function converts a value to a number. In this case, TRUE and FALSE results will become 1 and 0. On the other hand, double minus operator will only work for this purpose, to return numbers from Boolean values. Either will work for this example.

N(YEAR($B$3:$B$12)=D3) returns {1;1;1;1;1;1;1;0;0;0}

As a result both, formulas below return the same values.