+ Reply to Thread
Results 1 to 6 of 6

Return historic date, if weekend, then business day before

  1. #1
    Registered User
    Join Date
    07-12-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2010
    Posts
    4

    Return historic date, if weekend, then business day before

    I have this formula:

    EOMONTH($E$3;E9) returning e.g. 30-06-2011

    But if the date it returns is a weekend I want it to return the friday before.

    Can anyone help me with this problem?

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Return historic date, if weekend, then business day before

    Try..

    =IF(OR(WEEKDAY(EOMONTH($E$3,E9))=1,WEEKDAY(EOMONTH($E$3,E9))=7),WORKDAY(EOMONTH($E$3,E9),-1),WORKDAY(EOMONTH($E$3,E9),0))

    or

    =IF(WEEKDAY(EOMONTH($E$3,E9))=1,EOMONTH($E$3,E9)-2,IF(WEEKDAY(EOMONTH($E$3,E9))=7,EOMONTH($E$3,E9)-1,EOMONTH($E$3,E9)))
    Last edited by Ace_XL; 08-01-2012 at 06:46 AM.
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Registered User
    Join Date
    07-12-2012
    Location
    Copenhagen
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Return historic date, if weekend, then business day before

    Thank you very much

  4. #4
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Return historic date, if weekend, then business day before

    A bit shorter

    =WORKDAY(EOMONTH($E$3,E9),-(WEEKDAY(EOMONTH($E$3,E9),2)>5))

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,698

    Re: Return historic date, if weekend, then business day before

    ...shorter still.....

    =WORKDAY(EOMONTH($E$3;E9)+1;-1)
    Audere est facere

  6. #6
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Return historic date, if weekend, then business day before

    @ chfolke

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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