Count dates in a year

To count dates in a given year, you can use the SUMPRODUCT and YEAR functions. In the example shown, the formula in E5 is:

=SUMPRODUCT(--(YEAR(dates)=D5))

excelguy.co.za

What is (–) in the SUMPRODUCT formula?

Function (–) converts a return value of “TRUE” into 1 and a return value of “FALSE” into 0. It does not not effect the result. It is generally used with logical functions to convert Boolean type result to 0 or 1 form. It is also used with SUMPRODUCT formula in excel as it neglects non -numeric values. Using double minus user is able to convert TRUE/FALSE value to 1/0 form.