View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Rick Rothstein \(MVP - VB\)[_1077_] Rick Rothstein \(MVP - VB\)[_1077_] is offline
external usenet poster
 
Posts: 1
Default IS A TIME BETWEEN TWO TIMES EG 12:00 & 8:00

The reason I used the ROUNDUP function was to correct the entry at 8:00
which, because its time value is 0.3333... and when multiplied by 24 is ever
so slightly less than 8 which causes it to be incorrectly assigned to Early
rather than Day. Here is a more efficient formula to handle that lone
situation which doesn't incur the extra function call....

If A1 contains a time value only (e.g., 12:34)
**************************************************
=LOOKUP(24*A1+0.01,{0,8,16},{"Early","Day","Late"} )

If A1 contains a full date (e.g., 8/10/2008 12:34)
**************************************************
=LOOKUP(mod(24*A1+0.01,24),{0,8,16},{"Early","Day" ,"Late"})

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
Here is another formula for you to consider (note that I used 16:00 for
the switch over between Day and Late)...

If A1 contains a time value only (e.g., 12:34)
**************************************************
=LOOKUP(ROUNDUP(24*A1,9),{0,8,16},{"Early","Day"," Late"})

If A1 contains a full date (e.g., 8/10/2008 12:34)
**************************************************
=LOOKUP(MOD(ROUNDUP(24*A1,9),24),{0,8,16},{"Early" ,"Day","Late"})

Rick


"Shirley4589" wrote in message
...
Can you calculate whether a time is between two other times to show
early,
day or late shifts for example?