# How do I conditionally calculate a sum of values based on a date range?

I have two columns, A and C (with B in between them). A contains dates and C contains currency values. I would like to calculate a sum of all C values where the month of the corresponding A value falls within a given range. How do I do this?

My best attempt is this: SUM(IF(MONTH(A1:A9999)={3; 4; 5}; C1:C9999; 0)).

This returns always 0, however. The cause seems to be that the MONTH() function always returns 12 for any date values when given an array as input. DATE(A1:A2) gives 12 and 12. 1 and 1 would be correct with my data. If I include 12 in the array of values, it sums the values of all rows!