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 :)
 
Just registered as well to say THANK YOU Biff! Made my day, even if i have no idea what the formula really does in it's singular steps....but will reach there one day ;-) I loved the way it was visualized, result and formula, just had to adjust it to my needs, GREAT!
 
Upvote 0

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Try this...

Sheet1

*ABCDE

<colgroup><col style="width: 30px; font-weight: bold;"><col style="width: 67px;"><col style="width: 67px;"><col style="width: 60px;"><col style="width: 60px;"><col style="width: 60px;"></colgroup><tbody>
[TD="bgcolor: #CACACA, align: center"]1[/TD]
[TD="align: right"]Start[/TD]
[TD="align: right"]End[/TD]
[TD="align: right"]1/1/2009[/TD]
[TD="align: right"]2/1/2009[/TD]
[TD="align: right"]3/1/2009[/TD]

[TD="bgcolor: #CACACA, align: center"]2[/TD]
[TD="align: right"]1/2/2009[/TD]
[TD="align: right"]1/2/2009[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]

[TD="bgcolor: #CACACA, align: center"]3[/TD]
[TD="align: right"]1/16/2009[/TD]
[TD="align: right"]3/27/2009[/TD]
[TD="align: right"]16[/TD]
[TD="align: right"]28[/TD]
[TD="align: right"]27[/TD]

[TD="bgcolor: #CACACA, align: center"]4[/TD]
[TD="align: right"]2/3/2009[/TD]
[TD="align: right"]3/11/2009[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]26[/TD]
[TD="align: right"]11[/TD]

</tbody>



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.

This is almost exactly what I needed. How would you count the number of workdays in a month using the same layout?
 
Upvote 0
Welcome to the forum.

Try this formula in C2:

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

If you care about holidays, you should use the NETWORKDAYS.INTL function which allows you to add a list of holidays.
 
Upvote 0
Welcome to the forum.

Try this formula in C2:

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

If you care about holidays, you should use the NETWORKDAYS.INTL function which allows you to add a list of holidays.

Thank You!
That worked perfectly! Thank you so much!. Maybe this post could be pinned as it is very helpful.
 
Upvote 0
Glad it worked for you! :cool:

The trouble with pinning useful threads is that there are so many of them here! :eeek: A better way to search might be nice, but that would still be no guarantee of finding what you want. Worst case scenario, open a new thread and someone will spot it and respond to it. If you add to an old thread, it might not be seen.
 
Upvote 0
Welcome to the forum.

Try this formula in C2:

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

If you care about holidays, you should use the NETWORKDAYS.INTL function which allows you to add a list of holidays.

Thank you so much.. You are a genius i was searching for this formula for months for our budget report and had to manually calculate.
 
Upvote 0
I'm glad you found this useful! :cool:

Feel free to start a new thread if you can't find what you're looking for.
 
Upvote 0

Forum statistics

Threads
1,223,652
Messages
6,173,606
Members
452,522
Latest member
saeedfiroozei

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