Consulting

Results 1 to 3 of 3

Thread: Problem understanding formula for weekdays.

  1. #1
    VBAX Regular
    Joined
    Oct 2005
    Posts
    10
    Location

    Question Problem understanding formula for weekdays.

    Hi,

    I?m having trouble in correlating the numbers on the formulas below with the weekday that is beeing looked for.

    This is the formula for getting the 3rd. Thursday of any month of any year:


    =IF(OR(WEEKDAY(startdate,1)=6,WEEKDAY(startdate,1)=7),startdate-WEEKDAY(startdate,1)+5+7+14,startdate-WEEKDAY(startdate,1)+5+14)

    Note: "startdate" is the range name for cell A1 on worksheet.

    This is the one for getting the 2nd. Tuesday of any month of any year:

    =IF(OR(WEEKDAY(startdate,1)=1,WEEKDAY(startdate,1)=2),startdate-WEEKDAY(startdate,1)+3+7,startdate-WEEKDAY(startdate,1)+3+7+7)

    So, now I?m looking for the formula for the 1st. & 3rd. Monday, but I?m lost.

    Any help and advice is appreciated. Thank you.
    Capterdi

  2. #2
    VBAX Expert Shazam's Avatar
    Joined
    Sep 2005
    Posts
    530
    Location
    First Monday of the month:

    =DATE(YEAR(A2),MONTH(A2),1)-WEEKDAY(DATE(YEAR(A2),MONTH(A2),1)-2)+7


    Third Monday of the month:

    =DATE(YEAR(A2),MONTH(A2),1)-WEEKDAY(DATE(YEAR(A2),MONTH(A2),1)-2)+21
    SHAZAM!

  3. #3
    VBAX Regular
    Joined
    Oct 2005
    Posts
    10
    Location
    Hi Shazam,

    OK...this kind of formula is easier to understand. No problem at all!
    Thanks..!!

Posting Permissions

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