This is a formula I use to determine how much work people do during overtime hours, you can use the same princinple to get what you need;
Numbervar array wkdystart:= [0, 9, 9, 9, 9, 9, 0];
numbervar array lunchstart:=
if {Command.BaseUserName} in ["Ryan Rowland"]
then [0, 12, 12, 12, 12, 12, 0]
else if {Command.BaseUserName} in ["Emma Hall"]
then [0, 12.30, 12.30, 12.30, 12.30, 12.30, 0]
else[0, 13, 13, 13, 13, 13, 0];
numbervar array lunchend:=
if {Command.BaseUserName} in ["Ryan Rowland"]
then [0, 13, 13, 13, 13, 13, 0]
else if {Command.BaseUserName} in ["Emma Hall"]
then [0, 13.30, 13.30, 13.30, 13.30, 13.30, 0]
else [0, 14, 14, 14, 14, 14, 0];
numbervar array wkdyend:= [0, 17, 17, 17, 17, 17, 0];
if dayofweek({Command.TimeStamp}) in [7,1]
then "Weekend"
else if
{@Hour} = 1
then "Time Unknown"
else if
{@Hour} < wkdystart[dayofweek({Command.TimeStamp})]
Then "Morning OT"
else if
{@Hour}>= wkdyend[dayofweek({Command.TimeStamp})]
then "Evening OT"
else if (
{@Hour}>= lunchstart[dayofweek({Command.TimeStamp})] and
{@Hour}< lunchend[dayofweek({Command.TimeStamp})])
then "Lunch OT"
else if (
{@Hour}>= wkdystart[dayofweek({Command.TimeStamp})] and
{@Hour}< lunchstart[dayofweek({Command.TimeStamp})])
then "NT AM"
else if ({@Hour}>=lunchend[dayofweek({Command.TimeStamp})] and
{@Hour}< wkdyend[dayofweek({Command.TimeStamp})])
then "NT PM"
else "Time Unknown"
Your formula shouldn't need to be as complex as that as I'm guessing you don't need to take into consideration lunch hours nor individual people who work different hours.
Ryan.