#1   Report Post  
Ajit Munj
 
Posts: n/a
Default days in month - Ajit

If I put 01.02.2005 in Cell for Feb, 2005, How can I calculate total no. of
days i.e. total Sundays, total Mondays, total Tuesdays etc. in that month?
Ajit
--
Knowldege is Power
  #2   Report Post  
Biff
 
Posts: n/a
Default

Hi!

Here's one way:

A1 = 2/1/2005
A2 = 2/28/2005

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&A2)),2)=X))

Where X = 1 through 7 for Monday through Sunday

Biff

-----Original Message-----
If I put 01.02.2005 in Cell for Feb, 2005, How can I

calculate total no. of
days i.e. total Sundays, total Mondays, total Tuesdays

etc. in that month?
Ajit
--
Knowldege is Power
.

  #3   Report Post  
Bob Phillips
 
Posts: n/a
Default

Here is a way that doesn't need both dates, and A1 can hold any date in the
month

=4+(DAY($A$1-DAY($A$1)+35)<WEEKDAY($A$1-DAY($A$1)-C1))

where C1 holds the day number (1 =Mon, 2=Tue), etc.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Biff" wrote in message
...
Hi!

Here's one way:

A1 = 2/1/2005
A2 = 2/28/2005

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&A2)),2)=X))

Where X = 1 through 7 for Monday through Sunday

Biff

-----Original Message-----
If I put 01.02.2005 in Cell for Feb, 2005, How can I

calculate total no. of
days i.e. total Sundays, total Mondays, total Tuesdays

etc. in that month?
Ajit
--
Knowldege is Power
.



  #4   Report Post  
Ajit Munj
 
Posts: n/a
Default

Sorry Biff, Its not working! Its giving #Name error.

"Biff" wrote:

Hi!

Here's one way:

A1 = 2/1/2005
A2 = 2/28/2005

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&A2)),2)=X))

Where X = 1 through 7 for Monday through Sunday

Biff

-----Original Message-----
If I put 01.02.2005 in Cell for Feb, 2005, How can I

calculate total no. of
days i.e. total Sundays, total Mondays, total Tuesdays

etc. in that month?
Ajit
--
Knowldege is Power
.


  #5   Report Post  
Max
 
Posts: n/a
Default

"Ajit Munj" wrote
Sorry Biff, Its not working! Its giving #Name error.


Think you probably missed out the
significance of Biff's last line <g
Where X = 1 through 7 for Monday through Sunday


Plug a number (1 to 7) into the function to replace the "X",
for e.g.:

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&A2)),2)=1))

which'll return 4
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----




  #6   Report Post  
Bob Phillips
 
Posts: n/a
Default

This has been bothering me :-). Having to enter two dates, and the first and
last date of the month is not user friendly IMO (users make mistakes, lots
of them).

This can probably be done better, but here is an alternative on Biff's
formula that addresses both issues

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT($A$1-DAY($A$1)+1&":"&DATE(YEAR($A$1),MON
TH($A$1)+1,0))),2)=X))

X is as defined by Biff

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Biff" wrote in message
...
Hi!

Here's one way:

A1 = 2/1/2005
A2 = 2/28/2005

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&A2)),2)=X))

Where X = 1 through 7 for Monday through Sunday

Biff

-----Original Message-----
If I put 01.02.2005 in Cell for Feb, 2005, How can I

calculate total no. of
days i.e. total Sundays, total Mondays, total Tuesdays

etc. in that month?
Ajit
--
Knowldege is Power
.



  #7   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

On Wed, 9 Mar 2005 23:01:03 -0800, Ajit Munj wrote:

If I put 01.02.2005 in Cell for Feb, 2005, How can I calculate total no. of
days i.e. total Sundays, total Mondays, total Tuesdays etc. in that month?
Ajit


=4+(DAY(A1-DAY(A1)+1-WEEKDAY(A1-DAY(A1+desired_week_day))+35)7)

Assumes your date is in A1.

For desired_week_day substitute
1 for Sunday
2 for Monday
etc.
or a cell reference with those numbers in it.


--ron
  #8   Report Post  
Biff
 
Posts: n/a
Default

Hi Bob!

I've seen this formula before. I'm sure it works but I
haven't tried it out yet. But just looking at it I would
like to know the logic behind 4+ and +35.

Biff

-----Original Message-----
Here is a way that doesn't need both dates, and A1 can

hold any date in the
month

=4+(DAY($A$1-DAY($A$1)+35)<WEEKDAY($A$1-DAY($A$1)-C1))

where C1 holds the day number (1 =Mon, 2=Tue), etc.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Biff" wrote in message
...
Hi!

Here's one way:

A1 = 2/1/2005
A2 = 2/28/2005

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&A2)),2)=X))

Where X = 1 through 7 for Monday through Sunday

Biff

-----Original Message-----
If I put 01.02.2005 in Cell for Feb, 2005, How can I

calculate total no. of
days i.e. total Sundays, total Mondays, total Tuesdays

etc. in that month?
Ajit
--
Knowldege is Power
.



.

  #9   Report Post  
Biff
 
Posts: n/a
Default

Hi Bob!

Versatility!

It doesn't have to be the first and last date of any month!

It could be any two dates.

Biff

-----Original Message-----
This has been bothering me :-). Having to enter two

dates, and the first and
last date of the month is not user friendly IMO (users

make mistakes, lots
of them).

This can probably be done better, but here is an

alternative on Biff's
formula that addresses both issues

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT($A$1-DAY($A$1)

+1&":"&DATE(YEAR($A$1),MON
TH($A$1)+1,0))),2)=X))

X is as defined by Biff

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Biff" wrote in message
...
Hi!

Here's one way:

A1 = 2/1/2005
A2 = 2/28/2005

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&A2)),2)=X))

Where X = 1 through 7 for Monday through Sunday

Biff

-----Original Message-----
If I put 01.02.2005 in Cell for Feb, 2005, How can I

calculate total no. of
days i.e. total Sundays, total Mondays, total Tuesdays

etc. in that month?
Ajit
--
Knowldege is Power
.



.

  #10   Report Post  
Bob Phillips
 
Posts: n/a
Default

Hi Biff,

When I tried your original formula, it counted the number of a particular
day between those dates, whereas I read the OP to say the number in the
month. Subtle but different by my reading.

Regards

Bob

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Biff" wrote in message
...
Hi Bob!

Versatility!

It doesn't have to be the first and last date of any month!

It could be any two dates.

Biff

-----Original Message-----
This has been bothering me :-). Having to enter two

dates, and the first and
last date of the month is not user friendly IMO (users

make mistakes, lots
of them).

This can probably be done better, but here is an

alternative on Biff's
formula that addresses both issues

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT($A$1-DAY($A$1)

+1&":"&DATE(YEAR($A$1),MON
TH($A$1)+1,0))),2)=X))

X is as defined by Biff

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Biff" wrote in message
...
Hi!

Here's one way:

A1 = 2/1/2005
A2 = 2/28/2005

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&A2)),2)=X))

Where X = 1 through 7 for Monday through Sunday

Biff

-----Original Message-----
If I put 01.02.2005 in Cell for Feb, 2005, How can I
calculate total no. of
days i.e. total Sundays, total Mondays, total Tuesdays
etc. in that month?
Ajit
--
Knowldege is Power
.



.





  #11   Report Post  
Bob Phillips
 
Posts: n/a
Default

Hi Biff,

The 4 is the base point, every month will have at least 4 instances of each
day in that month.

The 35 is used (5 weeks x 7 days) to get outermost 5 week date from teh
start of the month, which is then compared to the weekday of the last day of
the previous month less the day number being checked. If this is True, it
has the effect of adding 1 to the base point, that is identifying if there
are 5.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Biff" wrote in message
...
Hi Bob!

I've seen this formula before. I'm sure it works but I
haven't tried it out yet. But just looking at it I would
like to know the logic behind 4+ and +35.

Biff

-----Original Message-----
Here is a way that doesn't need both dates, and A1 can

hold any date in the
month

=4+(DAY($A$1-DAY($A$1)+35)<WEEKDAY($A$1-DAY($A$1)-C1))

where C1 holds the day number (1 =Mon, 2=Tue), etc.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Biff" wrote in message
...
Hi!

Here's one way:

A1 = 2/1/2005
A2 = 2/28/2005

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&A2)),2)=X))

Where X = 1 through 7 for Monday through Sunday

Biff

-----Original Message-----
If I put 01.02.2005 in Cell for Feb, 2005, How can I
calculate total no. of
days i.e. total Sundays, total Mondays, total Tuesdays
etc. in that month?
Ajit
--
Knowldege is Power
.



.



  #12   Report Post  
Biff
 
Posts: n/a
Default

Got it! Thanks Bob.

Biff

-----Original Message-----
Hi Biff,

The 4 is the base point, every month will have at least 4

instances of each
day in that month.

The 35 is used (5 weeks x 7 days) to get outermost 5 week

date from teh
start of the month, which is then compared to the weekday

of the last day of
the previous month less the day number being checked. If

this is True, it
has the effect of adding 1 to the base point, that is

identifying if there
are 5.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Biff" wrote in message
...
Hi Bob!

I've seen this formula before. I'm sure it works but I
haven't tried it out yet. But just looking at it I would
like to know the logic behind 4+ and +35.

Biff

-----Original Message-----
Here is a way that doesn't need both dates, and A1 can

hold any date in the
month

=4+(DAY($A$1-DAY($A$1)+35)<WEEKDAY($A$1-DAY($A$1)-C1))

where C1 holds the day number (1 =Mon, 2=Tue), etc.

--

HTH

RP
(remove nothere from the email address if mailing

direct)


"Biff" wrote in message
...
Hi!

Here's one way:

A1 = 2/1/2005
A2 = 2/28/2005

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&A2)),2)

=X))

Where X = 1 through 7 for Monday through Sunday

Biff

-----Original Message-----
If I put 01.02.2005 in Cell for Feb, 2005, How can I
calculate total no. of
days i.e. total Sundays, total Mondays, total

Tuesdays
etc. in that month?
Ajit
--
Knowldege is Power
.



.



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Month and Days question Anthony Slater Excel Discussion (Misc queries) 2 February 22nd 05 12:29 PM
Count number of days in given month? Bryan Excel Worksheet Functions 10 February 2nd 05 11:44 PM
Summarizing of columns for different days of month Charles Excel Discussion (Misc queries) 4 January 18th 05 04:07 PM
How to Set a fix # of days per month iboock Excel Worksheet Functions 0 November 3rd 04 06:53 AM
Days of the Month Chip1035 Excel Worksheet Functions 3 October 30th 04 03:58 AM


All times are GMT +1. The time now is 05:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"