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:
=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.
Bookmarks