Count dates for previous month

S

scribbler1382

Hoping someone can help, I'm about to lose my mind. I've tried every
combination of sum, if, countif, sumproduct, you name it and I can't
figure it out.

I've got a column of dates. What I want to do is count the number of
dates that occurred last month, taking into consideration that a year
change could be between the current month and last month.

This was my latest attempt, but again it didn't work:

=SUM(IF(MONTH(C2:C8)=MONTH(TODAY()-DAY(TODAY())),1,0))

If you can save what's left of my sanity, please help.

Cheers,

Scrib
 
D

Domenic

Try...

=SUMPRODUCT(--(C2:C8-DAY(C2:C8)+1=DATE(YEAR(TODAY()),MONTH(TODAY())-1,1))
)

Hope this helps!
 
R

Ron Rosenfeld

Hoping someone can help, I'm about to lose my mind. I've tried every
combination of sum, if, countif, sumproduct, you name it and I can't
figure it out.

I've got a column of dates. What I want to do is count the number of
dates that occurred last month, taking into consideration that a year
change could be between the current month and last month.

This was my latest attempt, but again it didn't work:

=SUM(IF(MONTH(C2:C8)=MONTH(TODAY()-DAY(TODAY())),1,0))

If you can save what's left of my sanity, please help.

Cheers,

Scrib

You can use COUNTIF.

=COUNTIF(C2:C8,">"&DATE(YEAR(TODAY()),MONTH(TODAY())-1,0))-
COUNTIF(C2:C8,">"&TODAY()-DAY(TODAY()))
--ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top