G'Day all,
I'm trying to devise a formula that will count the amount of saturdays and sundays within a given date range.
Is this feasible within Excel?
G'Day all,
I'm trying to devise a formula that will count the amount of saturdays and sundays within a given date range.
Is this feasible within Excel?
Last edited by Xtopher; 05-25-2010 at 07:30 PM.
Regards,
Xtopher
Start Date in A1
End Date in A2
This formula will tell you how many Mondays are in the range:
=INT((A2 - A1 + WEEKDAY(A1 - 2)) / 7)
The number in RED is the key to what day is being counted.
1=Sundays
2=Mondays
etc....
Hat tip to Richard Schollar:
(source)
Last edited by JBeaucaire; 05-25-2010 at 09:16 PM.
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
?None of us is as good as all of us? - Ray Kroc
?Actually, I *am* a rocket scientist.? - JB (little ones count!)
....extending that, then, to count both Saturdays and Sundays, you can use this version
=SUM(INT((A2 - A1 + WEEKDAY(A1 - {1,7})) / 7))
.....or you could use the NETWORKDAYS formula in reverse. NETWORKDAYS counts non-weekend days so you can subtract that count from a count of the total days in your range, i.e.
=A2-A1+1-NETWORKDAYS(A1,A2)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks