Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
scwilly
 
Posts: n/a
Default 1st Monday of a month in date range??


Hello everyone,

I need to determine the number of 1st Mondays or any weeday e.g. 5th
Fridays between a date range e.g. 1/1/2006 - 4/1/2006.

I've noticed a lot of threads for calculating just one month but none
for a period of time.

Thanks so much in advance


--
scwilly
------------------------------------------------------------------------
scwilly's Profile: http://www.excelforum.com/member.php...o&userid=18251
View this thread: http://www.excelforum.com/showthread...hreadid=535648

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Coderre
 
Posts: n/a
Default 1st Monday of a month in date range??


Try this:

A1: (any date)
A2: (the occurrence to calculate…eg 3 for 3rd occurrence)
A3: (The day to find…eg MON for Monday)

C1:
=DATE(YEAR(A1),MONTH(A1),1+7*A2)-WEEKDAY(DATE(YEAR(A1),MONTH(A1),8-MATCH(A3,{"SUN","MON","TUE","WED","THU","FRI","SAT "},0)))

Does that help?

Regards,
Ron


--
Ron Coderre
------------------------------------------------------------------------
Ron Coderre's Profile: http://www.excelforum.com/member.php...o&userid=21419
View this thread: http://www.excelforum.com/showthread...hreadid=535648

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
scwilly
 
Posts: n/a
Default 1st Monday of a month in date range??


I'm basically trying to set up a table and I need to know how many 1st
Mondays occur in a month, how many 5th tuesdays occur in a given month
etc.

I need to work with a date range and not one fixed date like 1/1/2006
so I can count the number of times e.g. a 5th Tuesday occurs etc,
between 1/1/2006 and 4/1/2006

Thanks


--
scwilly
------------------------------------------------------------------------
scwilly's Profile: http://www.excelforum.com/member.php...o&userid=18251
View this thread: http://www.excelforum.com/showthread...hreadid=535648

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Domenic
 
Posts: n/a
Default 1st Monday of a month in date range??

Is this what you mean? Assuming that A2 contains the start date, and B2
contains the end date...

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A2&":"&B2)),2)=4),--(DAY(ROW(INDIRECT
(A2&":"&B2)))=15))

....which will count the number of times a Thursday occurs on the 15th of
the month within a given period.

For a different weekday, change the 4 accordingly. For example, Mon=1,
Tue=2, Wed=3, etc.

For a different day of the month, change the 15 accordingly.

Hope this helps!

In article ,
scwilly wrote:

I'm basically trying to set up a table and I need to know how many 1st
Mondays occur in a month, how many 5th tuesdays occur in a given month
etc.

I need to work with a date range and not one fixed date like 1/1/2006
so I can count the number of times e.g. a 5th Tuesday occurs etc,
between 1/1/2006 and 4/1/2006

Thanks

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Coderre
 
Posts: n/a
Default 1st Monday of a month in date range??


OK, scwilly....let's try this:

A1: (the 1st of the month to start)
A2: (the 1st of the month AFTER the last month)
A3: (the occurrence to calculate…eg 3 for 3rd occurrence)
A4: (The day to find…eg MON for Monday)

C1:
=SUMPRODUCT(--(MONTH(DATE(YEAR(A1),MONTH(A1)+ROW(A1:INDEX(A:A,DA TEDIF(A1,A2,"m"),1))-1,1+7*A3)-WEEKDAY(DATE(YEAR(A1),MONTH(A1)+ROW(A1:INDEX(A:A,D ATEDIF(A1,A2,"m"),1))-1,8-MATCH(A4,{"SUN","MON","TUE","WED","THU","FRI","SAT "},0))))=MONTH(DATE(YEAR(A1),MONTH(A1)+ROW(A1:INDE X(A:A,DATEDIF(A1,A2,"m"),1))-1,1))))

----------------
Test 1:
A1: 1/1/2006
A2: 4/1/2006
A3: 5
A4: WED

C1 returns 1
There is only one 5th WED of the month in the range Jan_2006 thru
MAR_2006. That occurrence is in MAR_2006.

-----------------
Test 2:
A1: 1/1/2006
A2: 4/1/2006
A3: 4
A4: WED

C1 returns 3
There is a 4th WED of the month in each month in the range Jan_2006
thru MAR_2006.

Helping Yet?


--
Ron Coderre
------------------------------------------------------------------------
Ron Coderre's Profile: http://www.excelforum.com/member.php...o&userid=21419
View this thread: http://www.excelforum.com/showthread...hreadid=535648



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
scwilly
 
Posts: n/a
Default 1st Monday of a month in date range??


I think we are on the right track; however, I can't get the formula to
work I don't know if it is the "date dif" part or what, help??


--
scwilly
------------------------------------------------------------------------
scwilly's Profile: http://www.excelforum.com/member.php...o&userid=18251
View this thread: http://www.excelforum.com/showthread...hreadid=535648

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
scwilly
 
Posts: n/a
Default 1st Monday of a month in date range??


You are somewhat on the right track instead of the "15th" of the month I
want to know how many e.g. 5th Tuesdays there are in a date range.
Help??


--
scwilly
------------------------------------------------------------------------
scwilly's Profile: http://www.excelforum.com/member.php...o&userid=18251
View this thread: http://www.excelforum.com/showthread...hreadid=535648

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
Formula for determining if two date columns fall within specific date range Igottabeme Excel Worksheet Functions 2 April 21st 06 02:50 AM
Formula for determining if two date columns fall within specific date range Igottabeme Excel Discussion (Misc queries) 1 April 20th 06 10:03 PM
Finding the date on the 'nth' Monday in this Month in this Year agarwaldvk Excel Worksheet Functions 1 April 17th 06 10:53 PM
Finding the Monday date based on a different date in same week dandiehl Excel Worksheet Functions 4 April 11th 06 06:03 PM
adding occurrences for date range Mike Excel Discussion (Misc queries) 1 April 28th 05 09:14 PM


All times are GMT +1. The time now is 03:37 AM.

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"