To find out number of sundays and saturdays in january month

P

pol

Hai all,


How I can find out the number of saturdays and sundays in January

For example in A1 and B1 cell represents Saturdays and Sundays. How I can
find out the number of saturdays and sundays in that month and to write in
corresponsing A2 and B2 column . Please help

with thanks and regards

Pol
 
D

Dave Peterson

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(DATE(2008,1,1)&":"&DATE(2008,1,31))),1)=1))
Would tell you the number of Sundays in January of 2008.

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(DATE(2008,1,1)&":"&DATE(2008,1,31))),1)=7))
Would tell you the number of Saturdays in January of 2008.

But I'm not really sure what you have in A1 and B1. Maybe the first and last
date of the month you're interested in?

If that's true, you could use:
=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&B1)),1)=1))
and
=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&B1)),1)=7))
 
R

Ron Rosenfeld

Hai all,


How I can find out the number of saturdays and sundays in January

For example in A1 and B1 cell represents Saturdays and Sundays. How I can
find out the number of saturdays and sundays in that month and to write in
corresponsing A2 and B2 column . Please help

with thanks and regards

Pol

With some date in the month of interest in C1

A2: Number of Saturdays
=5-(MONTH(36+C1-DAY(C1)-WEEKDAY(C1-DAY(C1)+1))<>MONTH(C1))

B2: Number of Sundays
=5-(MONTH(36+C1-DAY(C1)-WEEKDAY(C1-DAY(C1)+7))<>MONTH(C1))

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