the formula can be verified.
try using tools>formula auditing>evaluate formula..
=if(and(condition_1,condition_2),"On Time","Closure Time")
For the "And(true,true)"
condition_1 :
"HOUR(A2)>=7" : the Hour should be equal or past 7:00
AM.(e.g.7AM,7:30AM,11:30AM,6PM...)
condition_2 :
"ROUNDDOWN((A2-INT(A2)),8)
<=
(LOOKUP(WEEKDAY(A2),{1,2,3,4,5,6,7},{16,20,20,20,20,20,15}))/24"
when A2 is Monday with time at 20:00:01 or 8:00:01PM:
-------------Hour(A2)<=20 : the answer will be true, disregarding the
00:00:01 which was delimited by the Hour() function...as an hour integer
so, to provide more sensitivity on the formula, suggested was to use
"ROUNDDOWN((A2-INT(A2)),8) instead of Hour(A2)
for A2 with 20:00:01 or 8:00:01PM
ROUNDDOWN((A2-INT(A2)),8) = 0.8333449
this is 0.8333449 of 1 day
With this condition_2, the answer must be "False"
but using "=HOUR(A2)<=20" : the condition will be "True", which must not be.
For the Lookup
(LOOKUP(WEEKDAY(A2),{1,2,3,4,5,6,7},{16,20,20,20,20,20,15}))/24" : the curly
brackets contains the constants (numbers in this case).
{1,2,3,4,5,6,7} : Excel strores the weekdays numbered as 1 to 7, which
corresponds to Sunday thru Saturday.
{16,20,20,20,20,20,15} : the end hour for each day (sunday-saturday) that
limits the "On Time" criteria.
When Lookup found a match on Weekday(A2) = {1 or 2 or 3 or 4 or 5 or 6 or 7},
it will pull-out one value from {16,20,20,20,20,20,15}.
Meaning
if Weekday(a2) =1, Lookup result = 16
if Weekday(a2) =2, Lookup result = 20
if Weekday(a2) =7, Lookup result = 15
the lookup result will then be divided to 24, and convert the lookup result
into a portion of a day..
Try to segregate each functional formula and later merge them into one
formula, so you can verify and learn from it.
Regards and thanks for the feedback.