Home » excel » excel – IF statement using TIME

excel – IF statement using TIME

Posted by: admin April 23, 2020 Leave a comment

Questions:

I am trying to write an IF statement to look at a range for time and return either Shift A or Shift B.

This is my formula that isn’t working:

=IF(F2>TIME(6,0,0),IF(F2<TIME(16,0,0)),"A","B")
How to&Answers:

Use =AND where both (or more) conditions have to be met to result in TRUE. Then the second IF is not required. With:

=IF(AND(F2>TIME(6,0,0),F2<TIME(16,0,0)),"A","B")  

Shift A applies to just after 06:00 hrs through to just before 16:00 hrs and Shift B otherwise. IF and F so intermingled in the same formula was a little unfortunate!