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
[TABLE="width: 435"]
<tbody>[TR]
[TD="align: left"]04/24/2010[/TD]
[TD]04/02/2011[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD="align: left"]03/02/2011[/TD]
[TD]04/03/2011[/TD]
[TD]3[/TD]
[/TR]
</tbody><colgroup><col><col><col></colgroup>[/TABLE]


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 :)
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
this will calculate the number of days in a month. Where A1= your date
=DAY(EOMONTH(A1,0))
 
Upvote 0
[TABLE="width: 240"]
<tbody>[TR]
[TD="class: xl63, width: 64, bgcolor: transparent, align: left"]Start
[/TD]
[TD="class: xl63, width: 64, bgcolor: transparent, align: left"]End
[/TD]
[TD="class: xl63, width: 64, bgcolor: transparent, align: left"]Jan
[/TD]
[TD="class: xl63, width: 64, bgcolor: transparent, align: left"]Feb
[/TD]
[TD="class: xl63, width: 64, bgcolor: transparent, align: left"]Mar
[/TD]
[/TR]
[TR]
[TD="class: xl64, bgcolor: transparent, align: right"]1/2/2009
[/TD]
[TD="class: xl64, bgcolor: transparent, align: right"]1/2/2009
[/TD]
[TD="bgcolor: transparent, align: right"]1
[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="class: xl64, bgcolor: transparent, align: right"]1/16/2009
[/TD]
[TD="class: xl64, bgcolor: transparent, align: right"]3/27/2009
[/TD]
[TD="bgcolor: transparent, align: right"]16
[/TD]
[TD="bgcolor: transparent, align: right"]28
[/TD]
[TD="bgcolor: transparent, align: right"]27
[/TD]
[/TR]
[TR]
[TD="class: xl64, bgcolor: transparent, align: right"]2/3/2009
[/TD]
[TD="class: xl64, bgcolor: transparent, align: right"]3/11/2009
[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: right"]26
[/TD]
[TD="bgcolor: transparent, align: right"]11
[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:
Upvote 0
I found this formula: =MAX(0,MIN($E2,F$1+31-DAY(F$1+31))-MAX($D2,F$1)+1)

TO someone with a similar question where
E2: End date (April 1)
D2: Start Date (April 2)
F1: Name of Month : APR

However, this formula just return the total number of days in April; hence, 30. When in fact it shoudl return 2.
 
Upvote 0
Hello,

I was wondering if you found a formula that would caluculate this? Please let me know if I need to clarify. I realize at first the dates I provided were confusing as it should have said April 2011.

I believe the second chart shows the numbers I am looking to received.

Please help!

Thanks!
 
Upvote 0
Hello,

I was wondering if you found a formula that would caluculate this? Please let me know if I need to clarify. I realize at first the dates I provided were confusing as it should have said April 2011.

I believe the second chart shows the numbers I am looking to received.

Please help!

Thanks!
Try this...

Book1
ABCDE
1StartEnd1/1/20092/1/20093/1/2009
21/2/20091/2/2009100
31/16/20093/27/2009162827
42/3/20093/11/200902611
Sheet1

This formula entered in C2:

=MAX(0,MIN(EOMONTH(C$1,0),$B2)-MAX(C$1,$A2)+1)

Copy across as needed then down as needed.

Note that the EOMONTH function requires the Analysis ToolPak
add-in be installed if you're using a version of Excel prior to
Excel 2007. If you enter the formula and get a #NAME?
error look in Excel help for the EOMONTH function. It'll tell you
how to fix the problem.
 
Upvote 0

Forum statistics

Threads
1,223,648
Messages
6,173,555
Members
452,520
Latest member
Pingaware

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