Counting Days in Specific Month between Two Dates

acwhelan

New Member
Joined
Nov 1, 2011
Messages
24
Hello,

I am trying to determine a formula that will calculate the the number of days that fall within a certain month.

Example: April
04/24/201004/02/20112
03/02/201104/03/20113

<tbody>
</tbody><colgroup><col><col><col></colgroup>


I need to do this for the months of April to July so I can calculate a proration based on the days falling in a specific month.

Please assist :)
 
Hello,

When I use this formula it returns a value of how many days are in the specific month as opposed to the count of days between the period. In the three cases below it should show 1 for April and 0's for the other months. Also, I am running 2007 so the EOMONTH is available.

Please advise!
Service Period Begin
Service Period End
Apr
May
Jun
03/08/2011
04/01/2011
30
31
30
03/01/2011
04/01/2011
30
31
30
02/04/2011
04/01/2011
30
31
30

<tbody>
</tbody>
 
Upvote 0

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Hello,

When I use this formula it returns a value of how many days are in the specific month as opposed to the count of days between the period. In the three cases below it should show 1 for April and 0's for the other months. Also, I am running 2007 so the EOMONTH is available.

Please advise!
Service Period Begin
Service Period End
Apr
May
Jun
03/08/2011
04/01/2011
30
31
30
03/01/2011
04/01/2011
30
31
30
02/04/2011
04/01/2011
30
31
30

<TBODY>
</TBODY>
Here are the results I get using the formula I suggested.

Book1
ABCDE
1StartEnd4/1/20115/1/20116/1/2011
23/8/20114/1/2011100
33/1/20114/1/2011100
42/4/20114/1/2011100
Sheet1
 
Upvote 0
Here are the results I get using the formula I suggested.

Sheet1

ABCDE
1StartEnd4/1/20115/1/20116/1/2011
23/8/20114/1/2011100
33/1/20114/1/2011100
42/4/20114/1/2011100

<COLGROUP><COL style="FONT-WEIGHT: bold; WIDTH: 30px"><COL style="WIDTH: 61px"><COL style="WIDTH: 61px"><COL style="WIDTH: 61px"><COL style="WIDTH: 61px"><COL style="WIDTH: 61px"></COLGROUP><TBODY>
</TBODY>
Note that I use the 1st of the month dates for the column headers.
 
Upvote 0
HI,

I don't know why it is not working. I have everything done you have suggested. Please note that my Period End falls in Column E and my Period Begin in Column D


Period Begin
Period End
4/1/2011
5/1/2011
6/1/2011
03/08/2011
04/01/2011
30
31
30
03/01/2011
04/01/2011
=MAX(0,MIN(EOMONTH(F$1,0),$E3)-MAX(F$1,$D3)+1)
02/04/2011
04/01/2011
30
31
02/03/2011
04/01/2011
30
31

<tbody>
</tbody>
 
Upvote 0
HI,

I don't know why it is not working. I have everything done you have suggested. Please note that my Period End falls in Column E and my Period Begin in Column D


Period Begin
Period End
4/1/2011
5/1/2011
6/1/2011
03/08/2011
04/01/2011
30
31
30
03/01/2011
04/01/2011
=MAX(0,MIN(EOMONTH(F$1,0),$E3)-MAX(F$1,$D3)+1)
02/04/2011
04/01/2011
30
31
02/03/2011
04/01/2011
30
31

<TBODY>
</TBODY>
Here's a small sample file that demonstrates this.

zzzCountDays.xls 17kb

http://cjoint.com/?BHnqSHrIoPB
 
Upvote 0
I got it! I had everything correct. What happened was the worksheet that I exported was not actually recognizing formatted dates as dates. By using the Text to columns feature and get the dates to 'actually' format as a date and was able to get the formula to calculate correctly.

This sent me for a whirlwind!

Thank you so much, I know I can always count on you guys!
 
Upvote 0
I got it! I had everything correct. What happened was the worksheet that I exported was not actually recognizing formatted dates as dates. By using the Text to columns feature and get the dates to 'actually' format as a date and was able to get the formula to calculate correctly.

This sent me for a whirlwind!

Thank you so much, I know I can always count on you guys!
Excellent!

Thanks for the feedback! :cool:
 
Upvote 0
Hello,

i am trying to do the same but in the headers, I need to have only th month and not the complete First of the month with the year as well, since I have info into my Excel with various years. Is it possible to resolve this issue?
 
Upvote 0
Hi Biff / T. Valko,
I subscribed to this forum only to thank you for your code. You just made my life much easier.
Thanks to acwhelan for documenting the question properly so others would like to answer.
Cheers,
 
Upvote 0

Forum statistics

Threads
1,215,619
Messages
6,125,872
Members
449,267
Latest member
ajaykosuri

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