count how many weekends are in a month

Davers

Well-known Member
Joined
Sep 17, 2002
Messages
1,165
Is there a formula that will return the number of weekends between 2 dates?

Thanks for any help and have a good day,

Dave :p
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hi Dave,

This formula will return the number of Saturdays and Sundays between 2 dates:

=SUM(INT((B1-{1,7})/7)-INT((A1-{1,7}-1)/7))

where A1 is the beginning date and B1 is the ending date, inclusive. So:

=SUM(INT((B1-{1,7})/7)-INT((A1-{1,7}-1)/7))/2

would return the number of weekends, in a rough sense, since it has the possibility of returning a fractional amount. Of course, the INT() function would solve that, but the question then becomes how you want to handle a situation where A1 equals 25 April 2004 and B1 equals 1 May 2004. Obviously, there is a Saturday/Sunday pair here, but not together. The above equation needs to change to handle the situation where you want to count only whole bundled weekends.

--Tom
 
Upvote 0
This might ot be exactly what you want because it depends how you want to count a month beginning with Sunday or ending on Saturday (eg. July 2004). This could be adapted :-

=INT((B1-A1)/7)+IF(WEEKDAY(A1,2)>5,1,0)+IF(WEEKDAY(B1,2)>5,1,0)
 
Upvote 0
Thanks Tom!!! Worked perfectly! I don't care when the weekends are together or not....your formula worked great!!!!

Thanks again and have a good day,

Dave :pray:
 
Upvote 0
Here is a follow-on to my post above:
MrE4264.xls
ABCD
1BegdateEnddateSat/SunPairsSat/Sunbundles
21-Apr-0430-Apr-0444
31-May-0429-May-044.54
42-May-0431-May-044.54
51-Feb-0428-Feb-0443
61-Aug-0428-Aug-0443
731-Jul-0429-Aug-0455
81-Nov-0429-Nov-0444
Sheet3


The formula in C2 is:

=SUM(INT((B2-{1,7})/7)-INT((A2-{1,7}-1)/7))/2

while that in D2 is:

=INT((SUM(INT((B2-{1,7})/7)-INT((A2-{1,7}-1)/7))-(WEEKDAY(A2)=1))/2)

--Tom

(I don't believe BrianB's formula returns the same results.)
 
Upvote 0
Brian, thanks for responding...I'll pop your formula in and see how it works. Currently, I'm not sure how we are going to handle all the weekend situations. I was using NETWORKDAYS with a range of holidays to calculate how long it took to complete a project...However, they now want to know how many projects were started within 48 hours....I have 27 departments and countless projects to calculate. I can't think of any way to exclude weekends and holidays when I do a straight date - date calculation, but I thought this would be a step in the right direction. In fact, if everyone would take a look at this example and maybe suggest how to exclude weekends and holidays from my calculation...remember, the total time must be in [hh]:mm:ss because they want to know how many were started within 48 hours, not 2 business days like I had been doing...
Book1
ABCDEF
1SRNumberCreatedInProgressDateTotalHoursHours-WeekendBusinessDays:
21-7H3HKT3/12/200413:223/16/200412:5395:31:1947:31:193
Sheet1


Thanks for any help!!!

Have a good day,

Dave
 
Upvote 0
Dave, I'm not quite sure where you want to go with this, but maybe the following is of some use:
MrE4264.xls
ABCDEF
1SRNumberCreatedInProgressDateTotalHoursWkends&HolsHrs-(Wkends&Hols)
21-7H3HKT3/12/0413:223/16/0412:5395:31:19247:31:19
32-7J4JLU4/1/0413:224/16/0412:50359:28:005239:28:00
43-7K5KMV3/12/0413:224/2/0412:50503:28:006359:28:00
53-8K5LNW4/1/0413:224/2/0411:0821:46:00021:46:00
63-8K5LNY4/30/0413:005/4/0413:4596:45:00248:45:00
73-8K5LPP8/30/049:259/7/0410:40193:15:003121:15:00
83-9H2FCF11/24/0415:0011/29/0412:30117:30:00421:30:00
9
10Holidays
111/1/04
124/9/04
135/31/04
147/5/04
159/6/04
1611/25/04
1711/26/04
1812/24/04
Sheet4


Formulas are--

D2: =C2-B2
E2: =INT(C2)-INT(B2)-NETWORKDAYS(B2,C2,Holidays)+1
F2: =D2-E2

Note: Some mods to the above are necessary if you allow start or progress date/times to fall on a weekend or holiday.

HTH,

Tom
 
Upvote 0
Tom, very nice, that will come in handy!!! I appreciate you taking the time to help! I was at a stand still and getting ready to tell them they couldn't have that... :eek:

Thanks again and have a good day,

Dave (y)
 
Upvote 0

Forum statistics

Threads
1,215,020
Messages
6,122,709
Members
449,093
Latest member
Mnur

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