# “False” result not working on IF formula

Solved/Closed
Di - Jul 16, 2009 at 11:49 AM
aquarelle Posts 7140 Registration date Saturday April 7, 2007 Status Moderator Last seen March 25, 2024 - Jul 17, 2009 at 12:24 PM
Hello,
This is the formula:

=IF(Z2>=TIME(11|59|0)|"Afternoon"|"Morning")

The contents in cell Z2 is 10:31:30. I was hoping my formula result would be Morning, but it comes back as Afternoon. Please help.
Related:

## 3 responses

aquarelle Posts 7140 Registration date Saturday April 7, 2007 Status Moderator Last seen March 25, 2024 491
Jul 16, 2009 at 04:03 PM
Hello,

Try with this formula :
=IF(AND(HOUR(Z2)>11,MINUTE(Z2)>=0,SECOND(Z2)>=0),"Afternoon","Morning")

Best regards
It kind of works if I only use the hours. When I try the whole formula it gives me an error. I might be able to make it work with just the hours.

Thanks.
This is what I’ve been trying to accomplish if cell Z2 less than 12 return Morning, if less than 16 return Afternoon, if less than 18 return Evening, if less than 20 return Night, if any other time return Closed.

This is the formula I used that works:

=IF(AND(HOUR(X2)<12)|"Morning"|IF(AND(HOUR(X2)<16)|"Afternoon"|IF(AND(HOUR(X2)<18)|"Evening"|IF(AND(HOUR(X2)<20)|"Night"|"Closed"))))

Thank you "AQUARELLE" for starting me on the right track.
aquarelle Posts 7140 Registration date Saturday April 7, 2007 Status Moderator Last seen March 25, 2024 491
Jul 17, 2009 at 12:24 PM
Hi,
Happy to learn that my formula has been able to put you in the right track. I wish you good continuation. :)
Best regards