+ Reply to Thread
Results 1 to 13 of 13

Date of Third Fridays

  1. #1
    Forum Contributor
    Join Date
    02-12-2006
    Location
    London UK
    Posts
    109

    Date of Third Fridays

    I need a macro which, when given the date (eg StartMonth = 01/04/2006) of the first day of any month, will return the date of the third Friday of same month (eg ThirdFriday = 21/04/2006)

    Thanks
    Astrikor

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Take a look at Chip Pearson's date formulas
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Valued Forum Contributor Shijesh Kumar's Avatar
    Join Date
    05-26-2008
    Location
    Bangalore / India
    MS-Off Ver
    2000
    Posts
    717
    Hi,

    You can use the below function to arrive at the 3rd Friday of the month


    Please Login or Register  to view this content.
    Enter the 1st day of month in A1 and this formula will give the date when it would be 3rd friday.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Your post does not comply with Rule 5 of our Forum RULES. We have Seven question forums: Miscellaneous, General, Programming, Worksheet Functions, Charting, Excel 2007 Help and New Users. Please choose the appropriate forum, and post your question in ONLY one forum.

    Moved to Functions Forum

  5. #5
    Forum Contributor
    Join Date
    04-21-2007
    Location
    Lima, Peru
    MS-Off Ver
    2000, 2007, 2010
    Posts
    674

    Third Friday

    Hi

    If you need the result in a cell you could use something like
    Please Login or Register  to view this content.
    where A1 contains the original date and B1 the third Friday.

    In code
    Please Login or Register  to view this content.
    Regards

    Jeff

  6. #6
    Forum Contributor
    Join Date
    02-12-2006
    Location
    London UK
    Posts
    109

    appropriate forum

    Quote Originally Posted by royUK View Post
    Your post does not comply with Rule 5 of our Forum RULES. We have Seven question forums: Miscellaneous, General, Programming, Worksheet Functions, Charting, Excel 2007 Help and New Users. Please choose the appropriate forum, and post your question in ONLY one forum.

    Moved to Functions Forum
    Actually I do need a macro for this application, not a worksheet function (please see my original post).
    The macro will involve an "if" condition which on detection of a date will replace it with the date of the third Friday for the same month and year. This will be applied to a table in which dates will be randomly located. I am looking for the appropriate code for the conditional statement.
    Jeff's suggestion might be adaptable.

    Any other ideas?

    Many thanks
    Astrikor
    Last edited by astrikor; 01-13-2009 at 04:54 PM. Reason: clarity

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Quote Originally Posted by Shijesh Kumar View Post
    =(6-WEEKDAY(A1)+14)+A1
    Hello Shijesh,

    This formula doesn't work in all circumstances. When the 3rd Friday of the month is on the 21st it gives the 14th, e.g. August 2009. This formula will do it

    =A1-WEEKDAY(A1+1)+21

    ...somebody else will have to suggest some code, though.......

  8. #8
    Forum Contributor
    Join Date
    02-12-2006
    Location
    London UK
    Posts
    109
    Quote Originally Posted by daddylonglegs View Post
    Hello Shijesh,

    This formula doesn't work in all circumstances. When the 3rd Friday of the month is on the 21st it gives the 14th, e.g. August 2009. This formula will do it

    =A1-WEEKDAY(A1+1)+21

    ...somebody else will have to suggest some code, though.......
    Unfortunately, this formula does not always give the correct result either.
    If for example A1 is 06/06/2009 it reurrns 26/06/2009 (the 4th Friday).

    However, trawling through the forum I came across a formula which does appear to work. It is a more general formula for finding the date of any WEEKDAY for any recurrence. Recording the formula as a macro realises the following code:
    Please Login or Register  to view this content.
    I might be able to use this, but would prefer a less cumbersome version using variables which would make it independent of cell location.

    Still looking for suggestions!

    Thanks
    Astrikor

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Have you looked at Chip Pearson's date examples?

  10. #10
    Registered User
    Join Date
    01-08-2009
    Location
    Colorado
    MS-Off Ver
    Excel 2007, 2010 PC, 2011 Mac
    Posts
    41
    astrikor,

    This should work for you. Just change the source and destination range.

    Please Login or Register  to view this content.
    Hope this helps.
    Works fine in Excel 2007 in a button and on Worksheet_Change event.

  11. #11
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    You could use this function:
    Please Login or Register  to view this content.
    E.g., =NthWeekDay(2008, 4, 6, 3) returns 18 Apr 2008.
    Entia non sunt multiplicanda sine necessitate

  12. #12
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Quote Originally Posted by astrikor View Post
    Unfortunately, this formula does not always give the correct result either.
    If for example A1 is 06/06/2009 it reurrns 26/06/2009 (the 4th Friday).
    I didn't explicitly state as such but I was making the same assumption as Shijesh, that A1 would contain the 1st of the month.

    If A1 can contain any date then the formula can be adjusted like this to give the 3rd Friday of that month

    =A1-DAY(A1)-WEEKDAY(A1-DAY(A1)+2)+22
    Last edited by daddylonglegs; 01-15-2009 at 05:19 PM.

  13. #13
    Forum Contributor
    Join Date
    02-12-2006
    Location
    London UK
    Posts
    109
    Quote Originally Posted by extrapulp View Post
    astrikor,

    This should work for you. Just change the source and destination range.
    (code omitted - see previous post by extrapulp)
    Hope this helps.
    Works fine in Excel 2007 in a button and on Worksheet_Change event.
    Yup, and by making source and destination cells the same it simply overwrites any date in the cell with the third Friday for that date.
    Excellent - just what I need !
    Many thanks Extrapulp
    Astrikor

+ Reply to 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