Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / March 2008

Tip: Looking for answers? Try searching our database.

Finding 3rd (or 2nd) Sunday in a given year/month

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bob - 31 Mar 2008 12:51 GMT
For a given Year and Month, I need to find either the 3rd Sunday (if month =
Jan thru Oct) or the 2nd Sunday (if month = Nov or Dec).

Example:
Year = 2009
Month = 7
3rd Sunday in July 2009  = 7/19/2009

There are two additional rules that also need to be taken into account:
If the 1st of the month is Saturday, that weekend is counted as the 1st
weekend of the month.  However, if the 1st of the month is Sunday, that
weekend is counted as the 5th weekend of the previous month.

Example:
Year = 2009
Month = 11
2nd Sunday in November 2009  = 11/15/2009

Any help in coming up with a formula that takes into account the
aforementioned 4 rules would be greatly appreciated.

Thanks,
Bob
Niek Otten - 31 Mar 2008 13:06 GMT
Hi Bob,

Look here:

http://www.cpearson.com/excel/DateTimeWS.htm#LastWeekday

Signature

Kind regards,

Niek Otten
Microsoft MVP - Excel

| For a given Year and Month, I need to find either the 3rd Sunday (if month =
| Jan thru Oct) or the 2nd Sunday (if month = Nov or Dec).
[quoted text clipped - 19 lines]
| Thanks,
| Bob
Bob - 31 Mar 2008 13:29 GMT
Niek,
Thanks for the URL!  I really appreciate it.

I also found a solution posted by Ron Rosenfeld which I modified as follows:

=IF(MONTH(A1)<11,A1-DAY(A1)+23-WEEKDAY(A1-DAY(A1)+1),A1-DAY(A1)+16-WEEKDAY(A1-DAY(A1)+1))

The above formula appears to take into account my 4 rules below, although I
have tested it with only the 12 months in 2009.  I will continue to test it
with months in other years, just to be certain.

Thanks again for your help,
Bob

> Hi Bob,
>
[quoted text clipped - 25 lines]
> | Thanks,
> | Bob
Ron Rosenfeld - 31 Mar 2008 13:20 GMT
>For a given Year and Month, I need to find either the 3rd Sunday (if month =
>Jan thru Oct) or the 2nd Sunday (if month = Nov or Dec).
[quoted text clipped - 19 lines]
>Thanks,
>Bob

I believe this formula will do that, with a value in A1 that Excel recognizes
as a date:

=A1-DAY(A1)+15-WEEKDAY((A1-DAY(A1)))
+7*(MONTH(A1)<=10)+7*(WEEKDAY(A1-DAY(A1)+1)=1)
--ron
Bob - 31 Mar 2008 13:34 GMT
Ron,
I am constantly amazed with your sophisticated (and very efficient)
formulas.  Thanks a million!!!
Bob

> >For a given Year and Month, I need to find either the 3rd Sunday (if month =
> >Jan thru Oct) or the 2nd Sunday (if month = Nov or Dec).
[quoted text clipped - 26 lines]
> +7*(MONTH(A1)<=10)+7*(WEEKDAY(A1-DAY(A1)+1)=1)
> --ron
Ron Rosenfeld - 31 Mar 2008 16:32 GMT
>Ron,
>I am constantly amazed with your sophisticated (and very efficient)
>formulas.  Thanks a million!!!
>Bob

You're most welcome.  Glad to help.
--ron

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.