Using time to determine shifts

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to write an expression that will look in a column (which contains
times of day such as 1:22:49 PM and 5:30:32 AM) and if between 7AM and 3PM,
put a number 1 in a designated column, if between 3PM and 11PM put a 2, and
if between 11PM and 7AM put a three. Please help. Thanks in advance.
 
Try this:

iif([YourTimeField] between (#7:00:00 AM# and #3:00:00
PM#,1,iif([YourTimeField] between (#3:00:00 PM# and #11:00:00 PM#,2,3))

RW
 
oops should not have "(" in front of #7:00:00 AM# should be:
iif([YourTimeField] between #7:00:00 AM# and #3:00:00
PM#,1,iif([YourTimeField] between (#3:00:00 PM# and #11:00:00 PM#,2,3))

Robert_DubYa said:
Try this:

iif([YourTimeField] between (#7:00:00 AM# and #3:00:00
PM#,1,iif([YourTimeField] between (#3:00:00 PM# and #11:00:00 PM#,2,3))

RW

Mr. Smiley said:
I am trying to write an expression that will look in a column (which contains
times of day such as 1:22:49 PM and 5:30:32 AM) and if between 7AM and 3PM,
put a number 1 in a designated column, if between 3PM and 11PM put a 2, and
if between 11PM and 7AM put a three. Please help. Thanks in advance.
 
Back
Top