Excel - Determine if a time & date is regular or OOH
Excel - Determine if a time & date is regular or OOH
Author
Discussion

The_Burg

Original Poster:

4,853 posts

245 months

Wednesday 6th June 2018
quotequote all
Driving me mad.
I need to simply find if a date and time is BAU or OOH shift.

=IF(AND(R2>=TIMEVALUE("08:00:00"),R2<=TIMEVALUE("18:00:00")),"BAU","OOH")

Should give me if the time was outside of normal working 8am to 6pm.

=IF(WEEKDAY(R2,2)<6, "BAU", "OOH") to determine if it's a weekday or weekend.

So if both are OOH it should give me times and dates that are weekend or outside of normal working hours. (ignoring BH for now).

Where R2 is the cell containing the date and time

cb31

1,479 posts

167 months

Wednesday 6th June 2018
quotequote all
How about something like this which I used recently

=IF(OR(HOUR(R2)<8, WEEKDAY(R2)=7, WEEKDAY(R2)=1),"Out",IF(HOUR(R2)>16,"Out","In"))

Problem with this is that 08:00 and 17:00 are classed as out of hours when I suppose they should be in but it is a start of a working method. Probably a much better way to do it though.

The_Burg

Original Poster:

4,853 posts

245 months

Wednesday 6th June 2018
quotequote all
cb31 said:
How about something like this which I used recently

=IF(OR(HOUR(R2)<8, WEEKDAY(R2)=7, WEEKDAY(R2)=1),"Out",IF(HOUR(R2)>16,"Out","In"))

Problem with this is that 08:00 and 17:00 are classed as out of hours when I suppose they should be in but it is a start of a working method. Probably a much better way to do it though.
Many thanks, that seems to do what is required.

So for the next step if i want to count bank holiday as OOH, how could i do that?

Troubleatmill

10,210 posts

190 months

Wednesday 6th June 2018
quotequote all
The_Burg said:
cb31 said:
How about something like this which I used recently

=IF(OR(HOUR(R2)<8, WEEKDAY(R2)=7, WEEKDAY(R2)=1),"Out",IF(HOUR(R2)>16,"Out","In"))

Problem with this is that 08:00 and 17:00 are classed as out of hours when I suppose they should be in but it is a start of a working method. Probably a much better way to do it though.
Many thanks, that seems to do what is required.

So for the next step if i want to count bank holiday as OOH, how could i do that?
Start reading here.
https://support.office.com/en-us/article/workday-f...