Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Calculate number of Mondays betweeb 2 dates

I am looking for a formula that will calculate the number of Mondays
between 2 given dates (date will always be the 23rd of the month).

I am currently using =INT((D1-WEEKDAY(D1-1)-C1+8)/7)

This is working fine up until it hits a date where the 23rd falls on a
Monday.

e.g. 23rd Sept 23rd Oct 2008 = 4 Mondays (correct)
23rd Oct 23rd Nov 2008 = 4 Mondays (correct)
23rd Nov 23rd Dec 2008 = 5 Mondays (correct)

and so on

But when I get to 23rd Jan to 23rd Feb 2009 (which falls on a Monday),
Excel is returning 5. I am wanting to see 4 at this point, same for
23rd Feb to 23rd March.

How can I amend this formula?
23rd Sept 23rd Oct 2008 = 4 Mondays (correct)
23rd Sept 23rd Oct 2008 = 4 Mondays (correct)
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Calculate number of Mondays betweeb 2 dates

Hi,

First date in a1
later date in a2
Try
=SUM(IF(WEEKDAY(A1-1+ROW(INDIRECT("1:"&TRUNC(A2-A1)+1)))=2,1,0))

the =2 bit is for monday change to =1 for Sundaye etc
It's an array so commit with CTRL+Shift + Enter not just enter

Mike

" wrote:

I am looking for a formula that will calculate the number of Mondays
between 2 given dates (date will always be the 23rd of the month).

I am currently using =INT((D1-WEEKDAY(D1-1)-C1+8)/7)

This is working fine up until it hits a date where the 23rd falls on a
Monday.

e.g. 23rd Sept 23rd Oct 2008 = 4 Mondays (correct)
23rd Oct 23rd Nov 2008 = 4 Mondays (correct)
23rd Nov 23rd Dec 2008 = 5 Mondays (correct)

and so on

But when I get to 23rd Jan to 23rd Feb 2009 (which falls on a Monday),
Excel is returning 5. I am wanting to see 4 at this point, same for
23rd Feb to 23rd March.

How can I amend this formula?
23rd Sept 23rd Oct 2008 = 4 Mondays (correct)
23rd Sept 23rd Oct 2008 = 4 Mondays (correct)

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 320
Default Calculate number of Mondays betweeb 2 dates

Ctrl+shift+enter:
=SUM((WEEKDAY(ROW(INDIRECT(A1&":"&A2)))=2)*1)

"Mike H" wrote:

Hi,

First date in a1
later date in a2
Try
=SUM(IF(WEEKDAY(A1-1+ROW(INDIRECT("1:"&TRUNC(A2-A1)+1)))=2,1,0))

the =2 bit is for monday change to =1 for Sundaye etc
It's an array so commit with CTRL+Shift + Enter not just enter

Mike

" wrote:

I am looking for a formula that will calculate the number of Mondays
between 2 given dates (date will always be the 23rd of the month).

I am currently using =INT((D1-WEEKDAY(D1-1)-C1+8)/7)

This is working fine up until it hits a date where the 23rd falls on a
Monday.

e.g. 23rd Sept 23rd Oct 2008 = 4 Mondays (correct)
23rd Oct 23rd Nov 2008 = 4 Mondays (correct)
23rd Nov 23rd Dec 2008 = 5 Mondays (correct)

and so on

But when I get to 23rd Jan to 23rd Feb 2009 (which falls on a Monday),
Excel is returning 5. I am wanting to see 4 at this point, same for
23rd Feb to 23rd March.

How can I amend this formula?
23rd Sept 23rd Oct 2008 = 4 Mondays (correct)
23rd Sept 23rd Oct 2008 = 4 Mondays (correct)

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,480
Default Calculate number of Mondays betweeb 2 dates

Hi

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


--
Regards
Roger Govier

wrote in message
...
I am looking for a formula that will calculate the number of Mondays
between 2 given dates (date will always be the 23rd of the month).

I am currently using =INT((D1-WEEKDAY(D1-1)-C1+8)/7)

This is working fine up until it hits a date where the 23rd falls on a
Monday.

e.g. 23rd Sept 23rd Oct 2008 = 4 Mondays (correct)
23rd Oct 23rd Nov 2008 = 4 Mondays (correct)
23rd Nov 23rd Dec 2008 = 5 Mondays (correct)

and so on

But when I get to 23rd Jan to 23rd Feb 2009 (which falls on a Monday),
Excel is returning 5. I am wanting to see 4 at this point, same for
23rd Feb to 23rd March.

How can I amend this formula?
23rd Sept 23rd Oct 2008 = 4 Mondays (correct)
23rd Sept 23rd Oct 2008 = 4 Mondays (correct)


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Calculate number of Mondays betweeb 2 dates

Another one:

=INT((WEEKDAY(start-7,2)+end-start)/7)

--
Biff
Microsoft Excel MVP


wrote in message
...
I am looking for a formula that will calculate the number of Mondays
between 2 given dates (date will always be the 23rd of the month).

I am currently using =INT((D1-WEEKDAY(D1-1)-C1+8)/7)

This is working fine up until it hits a date where the 23rd falls on a
Monday.

e.g. 23rd Sept 23rd Oct 2008 = 4 Mondays (correct)
23rd Oct 23rd Nov 2008 = 4 Mondays (correct)
23rd Nov 23rd Dec 2008 = 5 Mondays (correct)

and so on

But when I get to 23rd Jan to 23rd Feb 2009 (which falls on a Monday),
Excel is returning 5. I am wanting to see 4 at this point, same for
23rd Feb to 23rd March.

How can I amend this formula?
23rd Sept 23rd Oct 2008 = 4 Mondays (correct)
23rd Sept 23rd Oct 2008 = 4 Mondays (correct)





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Calculate number of Mondays betweeb 2 dates

On 8 Sep, 17:42, "T. Valko" wrote:
Another one:

=INT((WEEKDAY(start-7,2)+end-start)/7)

--
Biff
Microsoft Excel MVP

wrote in message

...



I am looking for a formula that will calculate the number of Mondays
between 2 given dates (date will always be the 23rd of the month).


I am currently using =INT((D1-WEEKDAY(D1-1)-C1+8)/7)


This is working fine up until it hits a date where the 23rd falls on a
Monday.


e.g. 23rd Sept 23rd Oct 2008 = 4 Mondays (correct)
23rd Oct 23rd Nov 2008 = 4 Mondays (correct)
23rd Nov 23rd Dec 2008 = 5 Mondays (correct)


and so on


But when I get to 23rd Jan to 23rd Feb 2009 (which falls on a Monday),
Excel is returning 5. *I am wanting to see 4 at this point, same for
23rd Feb to 23rd March.


How can I amend this formula?
23rd Sept 23rd Oct 2008 = 4 Mondays (correct)
23rd Sept 23rd Oct 2008 = 4 Mondays (correct)- Hide quoted text -


- Show quoted text -


Thanks guys but these still trip up when they hit the months where a
Monday is also the 23rd! Extremely annoying but as there are only a
few a year I will manually amend for these months. Cheers anyway!
these formulas are good and I am sure will come in handy.
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,480
Default Calculate number of Mondays betweeb 2 dates

Hi

Thanks guys but these still trip up when they hit the months where a
Monday is also the 23rd! Extremely annoying but as there are only a
few a year I will manually amend for these months. Cheers anyway!
these formulas are good and I am sure will come in handy.


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

--
Regards
Roger Govier


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
Calculating the number of a Mondays between two dates AChua Excel Discussion (Misc queries) 2 January 25th 08 12:53 AM
Calculate next number using dates? cyndiwise notsowise Excel Worksheet Functions 12 April 2nd 07 09:02 AM
How do I calculate number of Mondays in a given month in Excel? Rossta Excel Worksheet Functions 3 May 26th 06 04:07 PM
calculating number of days (e.g., Mondays) between two dates girlfriend in school Excel Worksheet Functions 10 July 14th 05 07:21 PM
number of mondays in period nico Excel Discussion (Misc queries) 3 June 10th 05 02:07 AM


All times are GMT +1. The time now is 07:19 PM.

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

About Us

"It's about Microsoft Excel"