I'm trying to create a formula to determine whether a phone call was made inside or outside of business hours based on the day and time of the call
Business hours are Monday to Friday 8AM to 8PM and Saturday 8AM to 2PM.
So essentially what I need to create the formula for is;
if call is Monday, Tuesday, Wednesday, Thursday, Friday and time is >8 and <20 or call is Saturday and time is >8 and <14 then show "Inside Business Hours"
For everything else show "Outside Business Hours"
Thanks
You may try below formula.
See image for reference.
In the above formula,
WEEKDAY(A2)
will give day of the week (by default, it gives 1 for Sunday and 7 for Saturday)A2-INT(A2)
will extractTime
from theDataTime
cellTIMEVALUE("08:00 AM")
will give decimal number of the time in the stringIf you dates are starting in cell
A2
, please enter this formula in cellB2
and drag it to the bottom. your dates should be in this format9/16/2017 1:05:00 PM
.These are the opening hours in the range D1:G8:![enter image description here](https://i.stack.imgur.com/OMti7.png)
The date and time is in A2:
04.09.2017 20:00:00
This is the formula:
=IF(AND(TIME(HOUR(A2);MINUTE(A2);SECOND(A2)) > VLOOKUP(WEEKDAY(A2);E$2:G$8;2;FALSE)/24;TIME(HOUR(A2);MINUTE(A2);SECOND(A2)) < VLOOKUP(WEEKDAY(A2);E$2:G$8;3;FALSE)/24); "inside"; "outside")
I hope I got the English names correct. This is my German original:
=WENN(UND(ZEIT(STUNDE(A2);MINUTE(A2);SEKUNDE(A2)) > SVERWEIS(WOCHENTAG(A2);E$2:G$8;2;FALSCH)/24;ZEIT(STUNDE(A2);MINUTE(A2);SEKUNDE(A2)) < SVERWEIS(WOCHENTAG(A2);E$2:G$8;3;FALSCH)/24); "inside"; "outside")
This formula should be sufficient:
=IF(AND(WEEKDAY(A2)>1,MOD(A2,1)*24>=8,MOD(A2,1)*24<=IF(WEEKDAY(A2)=7,14,20)),"In","Out")