ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Count dates for previous month (https://www.excelbanter.com/excel-worksheet-functions/85794-count-dates-previous-month.html)

[email protected]

Count dates for previous month
 
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


Domenic

Count dates for previous month
 
Try...

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

Hope this helps!

In article . com,
wrote:

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


[email protected]

Count dates for previous month
 
Thank you very much, Domenic! That did the trick.


Ron Rosenfeld

Count dates for previous month
 
On 27 Apr 2006 17:44:11 -0700, wrote:

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


All times are GMT +1. The time now is 08:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com