Edate help

Mrthye

New Member
Joined
Mar 26, 2020
Messages
3
Office Version
  1. 2007
Platform
  1. Windows
I have column D filled with dates starting at D8. They are formatted MM/DD/YYYY and span several years, and a new date is added manually every few days.
I needed to count how many cells have a date that falls in the current month and year, and I found another post that suggested using SUMPRODUCT. I was able to alter a formula I found to do this, though I really don't understand what the SUMPRODUCT formula is actually doing, I just fumbled around with it until it worked:
=SUMPRODUCT(--(MONTH(D8:D9999)=MONTH(TODAY())),(--(YEAR(D8:D9999)=YEAR(TODAY()))))

However, now I am asked to get a similar count of the number of cells that have a date that falls in the last month and the month before that.

I have been trying to alter my SUMPRODUCT formula with the EDATE function, but I have been unable to find a way to make anything work. I have tried several COUNTIF formulas to achieve the same data count, but still can't come up with anything.

Any suggestions?
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Hi & welcome to MrExcel.
Are you trying to count all dates from the 1st of Feb to 31st Mar?
 
Upvote 0
I am trying to count all cells that have a date that is in February, but next month (April) I want it to show the last month's count (March). I'm trying to get a rolling monthly total so I don't have to edit the formula each month
 
Upvote 0
=SUMPRODUCT(--(TEXT(D8:D9999,"mmyyyy")=TEXT(EDATE(TODAY(),-1),"mmyyyy")))
 
Upvote 0
Thank You! I didn't realize I had to include TEXT in the first part!
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top