+ Reply to Thread
Results 1 to 7 of 7

IF STATEMENT and Dates

  1. #1
    Registered User
    Join Date
    03-26-2009
    Location
    Big Town, Texas
    MS-Off Ver
    Excel 2003
    Posts
    47

    IF STATEMENT and Dates

    First off, can Excel identify if a date falls on a Saturday or Sunday? If so, I want to write an IF statement for a series of month-ends (i.e. 12/31/2005, 1/31/2006, 2/28/2006...all the way to 4/30/2012) and if that date is a Saturday or Sunday, have it revert back to the previous Friday? For example, 12/31/2005 is a Saturday, and I need it to be 12/30/2005, the prior Friday, for another formula's reference.

    Any help would be huge! Thanks in advance.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: IF STATEMENT and Dates

    One way:

    =A7-IF(WEEKDAY(A1,2)=6,1,IF(WEEKDAY(A1,2)=7,2,0))
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    03-26-2009
    Location
    Big Town, Texas
    MS-Off Ver
    Excel 2003
    Posts
    47

    Re: IF STATEMENT and Dates

    Just a little clarity, what is A7 and A1 referencing?

    Thanks for your quick response.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: IF STATEMENT and Dates

    sorry they should all be A1, and that would be where the original date is...

    =A1-IF(WEEKDAY(A1,2)=6,1,IF(WEEKDAY(A1,2)=7,2,0))

  5. #5
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: IF STATEMENT and Dates

    If A1 only contains a random date ( not necessarily the last day of a month) try
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    03-26-2009
    Location
    Big Town, Texas
    MS-Off Ver
    Excel 2003
    Posts
    47

    Re: IF STATEMENT and Dates

    Got it to work. Thanks for your help!

  7. #7
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: IF STATEMENT and Dates

    If you can use Analysis ToolPak AddIn, you could also use,

    =WORKDAY(EOMONTH(A1,0)+1,-1)
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

+ 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