Results 1 to 4 of 4

If Sat subtract one day, if Sunday subtract tow days

Threaded View

  1. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,953

    Re: If Sat subtract one day, if Sunday subtract tow days

    Given: IF(D65="Sat",=DATE(YEAR(C65),MONTH(C65),DAY(C65)-1)
    1. If you have the words Saturday or Sunday in cell D65, you would have to test using:
    a) the whole word, i.e., IF(D65="Saturday"... or,
    b) The left three letters: IF(Left(D65,3)="Sat"...

    2. The "=" in front of DATE does not belong.
    3. Given a date in C65, just add or subtract a number from the date itself since dates in Excel are just the count of days since 01/01/1900 formatted by Excel as dates (03/31/2012 = 40999).

    Therefore, try:
    Formula: copy to clipboard
    =C65-IFERROR(MATCH(D65,{"Saturday","Sunday"},0),0)


    Match looks in the {} list for the value that matches D65 and returns its place in the list. If the value in D65 is not in the list, MATCH returns #NA. The IFERROR() function is used to convert the #NA to zero (in this case)

    So, the result is that the formula will subtract 1,2 or 0 from the date in C65.
    Last edited by protonLeah; 06-30-2012 at 03:20 PM.
    Ben Van Johnson

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