Closed Thread
Results 1 to 7 of 7

Determine date based on day of month (i.e. 2nd Tuesday of the month)

  1. #1
    csb
    Guest

    Determine date based on day of month (i.e. 2nd Tuesday of the month)

    I've used Excell for years and I'm usually pretty good at finding
    answers to my questions. However, this one has eluded me. I figure
    the answer is simple and I'll have a "DOH!" moment when it's pointed
    out...

    I'm trying to determine the date of the 2nd Tuesday of every month in
    2007.

    Ideally, I'd have two columns. First would have the month, the second
    would have the specific date of the 2nd Tuesday for that month.

    Can someone kindly point me in the right direction? I can't seem to
    figure this one out.


  2. #2
    Niek Otten
    Guest

    Re: Determine date based on day of month (i.e. 2nd Tuesday of the month)

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

    --
    Kind regards,

    Niek Otten
    Microsoft MVP - Excel

    "csb" <CSB001@gmail.com> wrote in message news:1155127029.076377.257100@h48g2000cwc.googlegroups.com...
    | I've used Excell for years and I'm usually pretty good at finding
    | answers to my questions. However, this one has eluded me. I figure
    | the answer is simple and I'll have a "DOH!" moment when it's pointed
    | out...
    |
    | I'm trying to determine the date of the 2nd Tuesday of every month in
    | 2007.
    |
    | Ideally, I'd have two columns. First would have the month, the second
    | would have the specific date of the 2nd Tuesday for that month.
    |
    | Can someone kindly point me in the right direction? I can't seem to
    | figure this one out.
    |



  3. #3
    Bob Phillips
    Guest

    Re: Determine date based on day of month (i.e. 2nd Tuesday of the month)

    =DATE(YEAR(A1),MONTH(A1),1+7*2)-WEEKDAY(DATE(YEAR(A1),MONTH(A1),8-3))

    where A1 holds a date

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "csb" <CSB001@gmail.com> wrote in message
    news:1155127029.076377.257100@h48g2000cwc.googlegroups.com...
    > I've used Excell for years and I'm usually pretty good at finding
    > answers to my questions. However, this one has eluded me. I figure
    > the answer is simple and I'll have a "DOH!" moment when it's pointed
    > out...
    >
    > I'm trying to determine the date of the 2nd Tuesday of every month in
    > 2007.
    >
    > Ideally, I'd have two columns. First would have the month, the second
    > would have the specific date of the 2nd Tuesday for that month.
    >
    > Can someone kindly point me in the right direction? I can't seem to
    > figure this one out.
    >




  4. #4
    csb
    Guest

    Re: Determine date based on day of month (i.e. 2nd Tuesday of the month)

    SOLVED!

    Thank you to Niek and Bob for the solutions. Both work great!

    I really appreciate your assistance.


  5. #5
    Michael Bednarek
    Guest

    Re: Determine date based on day of month (i.e. 2nd Tuesday of the month)

    On 9 Aug 2006 05:37:09 -0700, "csb" wrote in microsoft.public.excel:

    >I've used Excell for years and I'm usually pretty good at finding
    >answers to my questions. However, this one has eluded me. I figure
    >the answer is simple and I'll have a "DOH!" moment when it's pointed
    >out...
    >
    >I'm trying to determine the date of the 2nd Tuesday of every month in
    >2007.
    >
    >Ideally, I'd have two columns. First would have the month, the second
    >would have the specific date of the 2nd Tuesday for that month.
    >
    >Can someone kindly point me in the right direction? I can't seem to
    >figure this one out.


    Based on a formula on CP's web site, as pointed out by Niek:
    =A1+(WEEKDAY(A1)>=3)*7-WEEKDAY(A1)+3+7
    Finds the first Tuesday of a month and adds 7.

    This is a function without an implied If:

    =DATE(YEAR(A1),MONTH(A1),7*2-6+(MOD(3+7-WEEKDAY(DATE(YEAR(A1),MONTH(A1),1)),7)))

    where Tuesday (3) and the second occurrence have been hardwired but are still shown.
    It is derived from a 4NT function which computes the Qth occurrence of the weekday N:

    : Returns as a date the Q-th occurrence of the weekday N (1-7 = Sun-Sat) for the month of myDate
    : E.g.: @nWkDay[3,1,2005-05-01] whill return the date of the 3rd Sunday in May 2005
    nWkDay=%@MAKEDATE[%@DATE[%@YEAR[%3]-%@MONTH[%3]-%@EVAL[7 * %1 - 6 + (%2 + 7 - %@DOWI[%@YEAR[%3]-%@MONTH[%3]-1]) %% 7]],4]

    --
    Michael Bednarek http://mbednarek.com/ "POST NO BILLS"

    --
    Michael Bednarek http://mbednarek.com/ "POST NO BILLS"

  6. #6
    Registered User
    Join Date
    09-10-2015
    Location
    Caringbah, NSW, Australia
    MS-Off Ver
    Office 365
    Posts
    50

    Re: Determine date based on day of month (i.e. 2nd Tuesday of the month)

    Generally the formula works fine but then blows its brains out in certain years!

    DATE(YEAR(B36),MONTH(B36),7-1+(MOD(3+7-WEEKDAY(DATE(YEAR(B36),MONTH(B36),1)),7)))

    but it does not return the correct date for the first Monday of the month where B36 contains the value 1/8/1969 (dd/mm/yyyy)

    4 August 1969 - Monday
    I get the correct day show above by tweaking the formula to read

    DATE(YEAR(B36),MONTH(B36),1-1+(MOD(3+7-WEEKDAY(DATE(YEAR(B36),MONTH(B36),1)),7)))

    but then I do not consistently get the correct date for the first Monday of August where the date changes by column by one year until 2046. I

    For example 2045 gives the date as 31 July 2045 (a Monday but the wrong month!)

    Any idea about how to fix this so that EVERY year correctly returns the correct date for the first Monday of August?

    Greatly sppreciate the assistance!
    Attached Files Attached Files

  7. #7
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,674

    Re: Determine date based on day of month (i.e. 2nd Tuesday of the month)

    Quote Originally Posted by USAOz View Post
    Generally the formula works fine but then blows its brains out in certain years!
    You are responding to a thread that is 18 years old.

    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #1 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread

    Thread closed.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1