View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
John
 
Posts: n/a
Default Formula to Check Values between to variables

Think I might have tweaked it, to work as follows

=IF(AND($K2<($B2+P$1),$L2($B2+O$1)),"Yes","No")




"John" wrote in message
...
I wish to create a fomula that will return either "Yes" if an employee is
clocked in for a particular set hour and "No" if they are not

Cell K2 = Clockin Time i.e. start time
Cell L2 = Clockout Time i.e. finish time
Cell B2 = Date (as the clockin and clock out is formatted in dd/mm/yy
hh:mm:ss, wheras P1 is hh:mm:ss only)

Cells P1 to AM2 = Possible working hours for the Day

I wish to enter my required formula that will return either "Yes" or "No"
in Cells P2 to AM2. I have used the following formula but its given me an
incorrect value for the hour an employee finishes.

=IF(AND($K2<($B2+P1),$L2($B2+P1)),"Yes","No")

My logic is that IF the start time is less than the specific hour I am
checking AND the finish time is greater THEN "Yes" - the employee must be
working, otherwise "No"

The problem in my logic is that always in the last hour the employee works
my formula will return "No" as L2 will never be greater than (B2+P1)

This seems simple but my brain has turned to jelly, any suggestions?

Thanks