If AND OR date formula

New Contributor

My sheet is set up as follows:

A2 enter date 1/1/21

B2 enter date 1/5/21

C2 enter date 1/10/21

D2 = current date if C2 is left blank

E2 will answer yes/no

I cannot figure a formula that work, any ideas?

If (B2=>A2 and B2<=C2 "YES") OR if (B2>=A2 and B2<=D2 "YES") otherwise "NO"

 

4 Replies

@burd24 

Try

=IF(AND(B2>=A2,OR(B2<=C2,B2<=D2)),"YES","NO")

@Hans Vogelaar Thanks so much! I still have one error... If I put 1/21/21 in A2, 1/30/21 in B2 and 1/20/21 in C2, E2 reflects yes (as in yes it is between A2 and B2 which we know it is not.

 

All the other dates I put in seem to work, it was just by chance I put 1/30/21 in B2...  thank you again in advance for your time.

@burd24 

Try this version:

=IF(AND(B2>=A2,OR(B2<=C2,AND(D2<>"",B2<=D2))),"YES","NO")
You are THE MAN!!! Thanks so much!