You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Using COUNTIF with Dates

Hello. I've just transitioned to using Numbers recently and I'm having a lot of difficulty implementing equations. One such trouble that's been consuming a lot of my time is the following, something I didn't think would be so difficult to implement. I have numerous dates in one column and in another I just want to count how many dates include a specific year. The following picture is what I'm aiming for, but can't seem to do. Any help would be appreciated, thank you.

Posted on Nov 9, 2021 3:31 PM

Reply
Question marked as Top-ranking reply

Posted on Nov 9, 2021 4:34 PM

Hi NB,


COUNTIFS is your friend here.


COUNTIF can handle only one comparison. In this case you want to count occurrences that fall within a one calendar year period.


Put into words, you want the occurrences on or after the first day of the year AND before the first day of the next year.


Here's an example, using your sample data:

Column B contains the Date & Time values that are to be counted.

Cell D2 contains the number 2019, which the first DATE will use to construct the 'smallest' date for which the dates will be counted, and the second DATE will calculate the date 12 months later.


D3 contains the number of the following year, used by the copy of the formula in row 3.


Translated to English, the formula in E2 says:

Count the rows in which the date is on or after the first day of the year in D2 AND is before the first day of the month 12 months later. As the formula is filled down,the row of the D2 reference will increment by one for each row.


Copy/paste version of the formula:

COUNTIFS(B,">="&DATE(D2,1,1),B,"<"&EDATE(DATE(D2,1,1),12))


Regards,

Barry




7 replies
Question marked as Top-ranking reply

Nov 9, 2021 4:34 PM in response to NotchBook

Hi NB,


COUNTIFS is your friend here.


COUNTIF can handle only one comparison. In this case you want to count occurrences that fall within a one calendar year period.


Put into words, you want the occurrences on or after the first day of the year AND before the first day of the next year.


Here's an example, using your sample data:

Column B contains the Date & Time values that are to be counted.

Cell D2 contains the number 2019, which the first DATE will use to construct the 'smallest' date for which the dates will be counted, and the second DATE will calculate the date 12 months later.


D3 contains the number of the following year, used by the copy of the formula in row 3.


Translated to English, the formula in E2 says:

Count the rows in which the date is on or after the first day of the year in D2 AND is before the first day of the month 12 months later. As the formula is filled down,the row of the D2 reference will increment by one for each row.


Copy/paste version of the formula:

COUNTIFS(B,">="&DATE(D2,1,1),B,"<"&EDATE(DATE(D2,1,1),12))


Regards,

Barry




Using COUNTIF with Dates

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.