Formula help between booking time and actual arrival time.

HissingDust

New Member
Joined
Jan 17, 2022
Messages
3
Office Version
  1. 2016
Platform
  1. Windows
Hello,

I am trying to create a formula that will tell me if a driver arrived at my site, early late or on time.

I have some KPIs to use:
Within 15 mins
Inside Booking Window Hour
Missed Slot 16m to 1Hr Early
Missed Slot 1Hr to 3Hrs Early
Missed Slot Over 3Hrs Early
Missed Slot 1Hr to 3Hrs Late
Missed Slot Over 3Hrs Late
Unfulfilled = Blank cell in registration column D

My booked times start in C2 and actual arrival time is D2. I have also been struggling because the time sometimes cross into a different day.

Booking timeRegistration
2022-01-14 00:302022-01-13 23:00

Any help is much appreciated.

Thanks
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
I have been using this formula I found on another forum. I would just like to know how to tailor it to my KPIs.

=IF(ISBLANK(D1),"",IF(D2 < C2,"Early",IF(D2=C2,"On time",IF(D2-C2<=30/1440,"Needs improving","LATE"))))
 
Upvote 0
Hi HissingDust,

I'me not sure about your "Inside Booking Window Hours" as that would seem to also be within 15 minites and 16 minutes to 1 hour, negative and positive, but this should work for you other checks.

HissingDust.xlsx
CDE
1BookedArrivedMessage
201-Jan-22 06:00:0001-Jan-21 00:00:00Missed Slot Over 3hrs Early
301-Jan-22 06:00:0001-Jan-22 02:00:00Missed Slot Over 3hrs Early
401-Jan-22 06:00:0001-Jan-22 04:15:00Missed Slot 1Hr to 3Hrs Early
501-Jan-22 06:00:0001-Jan-22 05:30:00Missed Slot 16m to 1Hr Early
601-Jan-22 06:00:0001-Jan-22 05:46:00Within 15 mins
701-Jan-22 06:00:0001-Jan-22 06:01:00Within 15 mins
801-Jan-22 06:00:0001-Jan-22 06:14:00Within 15 mins
901-Jan-22 06:00:0001-Jan-22 06:16:00Missed Slot 16m to 1hr Late
1001-Jan-22 06:00:0001-Jan-22 06:31:00Missed Slot 16m to 1hr Late
1101-Jan-22 06:00:0001-Jan-22 06:46:00Missed Slot 16m to 1hr Late
1201-Jan-22 06:00:0001-Jan-22 07:01:00Missed Slot 1hr to 3hrs Late
1301-Jan-22 06:00:0001-Jan-22 07:16:00Missed Slot 1hr to 3hrs Late
1401-Jan-22 06:00:0001-Jan-22 07:31:00Missed Slot 1hr to 3hrs Late
1501-Jan-22 06:00:0001-Jan-22 07:46:00Missed Slot 1hr to 3hrs Late
1601-Jan-22 06:00:0001-Jan-22 11:01:00Missed Slot Over 3hrs Late
1701-Jan-22 06:00:0001-Jan-22 11:16:00Missed Slot Over 3hrs Late
1801-Jan-22 06:00:0030-Nov-22 11:16:00Missed Slot Over 3hrs Late
1901-Jan-22 06:00:00Unfulfilled
20 
Sheet1 (2)
Cell Formulas
RangeFormula
E2:E20E2=IF(C2="","",IF(D2="","Unfulfilled",INDEX({"Missed Slot Over 3hrs Early","Missed Slot 1Hr to 3Hrs Early","Missed Slot 16m to 1Hr Early","Within 15 mins","Missed Slot 16m to 1hr Late","Missed Slot 1hr to 3hrs Late","Missed Slot Over 3hrs Late"},MATCH((VALUE(D2-C2)),{-99999,-0.125,-0.04167,-0.01042,0.01042,0.041667,0.125,99999},1))))
 
Upvote 0
Solution
I'me not sure about your "Inside Booking Window Hours" as that would seem to also be within 15 minites and 16 minutes to 1 hour, negative and positive,
There is no 16 minutes to 1 hour late in that original list so just guessing that "Inside Booking Window Hour" might mean that
.. or possibly it might mean 0 to 1 hour late and within 15 minutes might only apply to early arrival.

I know the OP needs to specify, but tossing in a couple of ideas for consideration/clarification.
 
Upvote 0
Hi HissingDust,

I'me not sure about your "Inside Booking Window Hours" as that would seem to also be within 15 minites and 16 minutes to 1 hour, negative and positive, but this should work for you other checks.

HissingDust.xlsx
CDE
1BookedArrivedMessage
201-Jan-22 06:00:0001-Jan-21 00:00:00Missed Slot Over 3hrs Early
301-Jan-22 06:00:0001-Jan-22 02:00:00Missed Slot Over 3hrs Early
401-Jan-22 06:00:0001-Jan-22 04:15:00Missed Slot 1Hr to 3Hrs Early
501-Jan-22 06:00:0001-Jan-22 05:30:00Missed Slot 16m to 1Hr Early
601-Jan-22 06:00:0001-Jan-22 05:46:00Within 15 mins
701-Jan-22 06:00:0001-Jan-22 06:01:00Within 15 mins
801-Jan-22 06:00:0001-Jan-22 06:14:00Within 15 mins
901-Jan-22 06:00:0001-Jan-22 06:16:00Missed Slot 16m to 1hr Late
1001-Jan-22 06:00:0001-Jan-22 06:31:00Missed Slot 16m to 1hr Late
1101-Jan-22 06:00:0001-Jan-22 06:46:00Missed Slot 16m to 1hr Late
1201-Jan-22 06:00:0001-Jan-22 07:01:00Missed Slot 1hr to 3hrs Late
1301-Jan-22 06:00:0001-Jan-22 07:16:00Missed Slot 1hr to 3hrs Late
1401-Jan-22 06:00:0001-Jan-22 07:31:00Missed Slot 1hr to 3hrs Late
1501-Jan-22 06:00:0001-Jan-22 07:46:00Missed Slot 1hr to 3hrs Late
1601-Jan-22 06:00:0001-Jan-22 11:01:00Missed Slot Over 3hrs Late
1701-Jan-22 06:00:0001-Jan-22 11:16:00Missed Slot Over 3hrs Late
1801-Jan-22 06:00:0030-Nov-22 11:16:00Missed Slot Over 3hrs Late
1901-Jan-22 06:00:00Unfulfilled
20 
Sheet1 (2)
Cell Formulas
RangeFormula
E2:E20E2=IF(C2="","",IF(D2="","Unfulfilled",INDEX({"Missed Slot Over 3hrs Early","Missed Slot 1Hr to 3Hrs Early","Missed Slot 16m to 1Hr Early","Within 15 mins","Missed Slot 16m to 1hr Late","Missed Slot 1hr to 3hrs Late","Missed Slot Over 3hrs Late"},MATCH((VALUE(D2-C2)),{-99999,-0.125,-0.04167,-0.01042,0.01042,0.041667,0.125,99999},1))))
Thank you so much for your help. I don't think I would have cracked that within the next 10 years.
 
Upvote 0
Thank you so much for your help. I don't think I would have cracked that within the next 10 years.
You're welcome!

Let me explain in case you have similar requirements again.

The key is MATCH which usually has a match_type of zero or FALSE, meaning find me an exact match. In this case I'm using a match_type of 1 which the Microsoft documentation explains "MATCH finds the largest value that is less than or equal to lookup_value. The values in the lookup_array argument must be placed in ascending order."

That last high value of all the 9's is unnecessary and I embedded the INDEX and MATCH in the formula but this is probably easier to explain if I put the range and message in a table. Columns G and H are just there to show the interim values.

HissingDust.xlsx
CDEFGHIJK
1BookedArrivedMessageMATCHD2 minus C2Arrived minus BookedMessage
201-Jan-22 06:00:0001-Jan-21 00:00:00Missed Slot Over 3hrs Early1-365.25000-9999.00000Missed Slot Over 3hrs Early
301-Jan-22 06:00:0001-Jan-22 02:00:00Missed Slot Over 3hrs Early1-0.16667-0.12500Missed Slot 1Hr to 3Hrs Early
401-Jan-22 06:00:0001-Jan-22 04:15:00Missed Slot 1Hr to 3Hrs Early2-0.07292-0.04167Missed Slot 16m to 1Hr Early
501-Jan-22 06:00:0001-Jan-22 05:30:00Missed Slot 16m to 1Hr Early3-0.02083-0.01042Within 15 mins
601-Jan-22 06:00:0001-Jan-22 05:46:00Within 15 mins4-0.009720.01042Missed Slot 16m to 1hr Late
701-Jan-22 06:00:0001-Jan-22 06:01:00Within 15 mins40.000690.04167Missed Slot 1hr to 3hrs Late
801-Jan-22 06:00:0001-Jan-22 06:14:00Within 15 mins40.009720.12500Missed Slot Over 3hrs Late
901-Jan-22 06:00:0001-Jan-22 06:16:00Missed Slot 16m to 1hr Late50.01111
1001-Jan-22 06:00:0001-Jan-22 06:31:00Missed Slot 16m to 1hr Late50.02153
1101-Jan-22 06:00:0001-Jan-22 06:46:00Missed Slot 16m to 1hr Late50.03194
1201-Jan-22 06:00:0001-Jan-22 07:01:00Missed Slot 1hr to 3hrs Late60.04236
1301-Jan-22 06:00:0001-Jan-22 07:16:00Missed Slot 1hr to 3hrs Late60.05278
1401-Jan-22 06:00:0001-Jan-22 07:31:00Missed Slot 1hr to 3hrs Late60.06319
1501-Jan-22 06:00:0001-Jan-22 07:46:00Missed Slot 1hr to 3hrs Late60.07361
1601-Jan-22 06:00:0001-Jan-22 11:01:00Missed Slot Over 3hrs Late70.20903
1701-Jan-22 06:00:0001-Jan-22 11:16:00Missed Slot Over 3hrs Late70.21944
1801-Jan-22 06:00:0030-Nov-22 11:16:00Missed Slot Over 3hrs Late7333.21944
1901-Jan-22 06:00:00Unfulfilled
2nd
Cell Formulas
RangeFormula
G2:G18G2=MATCH((VALUE(D2-C2)),$J$2:$J$8,1)
H2:H18H2=D2-C2
E2:E19E2=IF(C2="","",IF(D2="","Unfulfilled",INDEX($K$2:$K$8,MATCH((VALUE(D2-C2)),$J$2:$J$8,1))))


That -9999 is 9999 days ago, which is about 28 years ago. You can verify this by changing an Arrived date to 28 years ago and the MATCH will fail with a #N/A error as it will be less than -9999 days ago.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top