0

I am trying to creat a validation that says the date can only be today() + or -7 AND it can not be a weekend. I have gotten the two parts to work seperaTELY but not together. I do not seem to be able to layer one validation on top of the other and I can not figure out how to combine them into one.

I have a validation of date between TODAY()-7 and TODAY()+7 and I have one =AND(weekdayA1<>1,WeekdayA1<>7).

ideas ?

Kevin
  • 1

2 Answers2

2

Like Mike said, just separate every condition that must be true by a comma. This checks the date range, then checks if it's a weekday. You get a result of TRUE or FALSE.

=AND(AND(A1>=TODAY()-7,A1<=TODAY()+7,WEEKDAY(A1)<>1,WEEKDAY(A1)<>7))

 

If you want to return text or another value based on your date validation, replace the first AND with an IF

=IF(AND(A1>=TODAY()-7,A1<=TODAY()+7,WEEKDAY(A1)<>1,WEEKDAY(A1)<>7),"YES","NO")
0

You can nest multiple AND functions:

=AND(AND(condition1, condition2), condition3)

Edit:

I was thinking of nested IF statements when I wrote this. AND can be nested but it also supports multiple inputs, so the following is perfectly acceptable:

AND(condition1, condition2, condition3)

The result will only be TRUE if all three conditions are TRUE.