Counting Days of Week

S

Soccer boy

I am currently trying to count how many sundays and saturdays there are
inbetween two given dates. is there a function that could help me with this
or easy way of doing it.
For example:
Input - Beginning Date - Sun 5/3/09
Input - End Date - Sun 5/31/09
Output - # of Sundays - 5
Output - # of Saturdays - 4

I know there is the NETWORKDAYS function and i could just subtract Total
days from Net Work Days to get total Weekend days. but if i want to break it
up even more is there a way i could do that.
 
P

Pete_UK

If you always have Sundays as your start and end dates, you could do
this:

=INT((B2-B1)/7)+1

where B2 is the End Date. Just leave the +1 off for the number of
Saturdays.

Hope this helps.

Pete
 
R

Ron Rosenfeld

On Tue, 20 Jan 2009 15:47:01 -0800, Soccer boy <Soccer
I am currently trying to count how many sundays and saturdays there are
inbetween two given dates. is there a function that could help me with this
or easy way of doing it.
For example:
Input - Beginning Date - Sun 5/3/09
Input - End Date - Sun 5/31/09
Output - # of Sundays - 5
Output - # of Saturdays - 4

I know there is the NETWORKDAYS function and i could just subtract Total
days from Net Work Days to get total Weekend days. but if i want to break it
up even more is there a way i could do that.


=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(Start_Date & ":" & End_Date)))=DOW))

For DOW, Sun = 1; Mon = 2; etc.

If you wanted to total all the Saturdays and Sundays, you could use either:

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(Start_Date & ":" & End_Date)))=1))
+SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(Start_Date & ":" & End_Date)))=6))

Or you could use:

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(Start_Date & ":" & End_Date)))={1,6}))

--ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top