Time formula assistance

Hakunabrotata

New Member
Joined
Jul 6, 2022
Messages
12
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hi,

Could someone help me to build a set of 3 formula for the following query please?

I need to establish whether someone has successfully met their appointment time slot. They are allowed to arrive up to 45 minutes beforehand and be 15 minutes late. If they arrived within this hour slot, they will have made their appointment. If they are over 15 minutes late to the appointment time or arrive earlier than 45 minutes - they haven't met their appointment criteria.

1678989704955.png


Would someone be able to provide me with a formula for the following 3 cells:

- Arrived on time (within 45 mins of appt but no more than 15mins late)
- >45 early (arriving more than 45 minutes early)
- >15 minutes late (arriving over 15 mins late to appt time)

Any assistance would be greatly appreciated.

Thank you in advance.
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Or is it even possible to have the formula just in one cell - so it would present 3 possible answers?

For example:

Early (more than 45 mins early)
On time (Less than 45 mins early and no later than 15 mins)
Late (over 15 mins late)
 
Upvote 0
This should be pretty much self explanatory (I HOPE!).
Book1
ABCDEF
1Date/Time Format: mm/dd/yyyy hh:mm
2AppointmentArrivedOn Time?> 45 Minutes Early?> 15 Late?
301/02/2023 09:2501/02/2023 09:15YesNONO
40.3923611110.385416667TRUENONO
501/02/2023 09:2501/02/2023 09:26NONONO
60.3923611110.393055556FALSENONO
701/02/2023 09:2501/02/2023 08:26YesYesNO
80.3923611110.351388889TRUEYesNO
901/02/2023 09:2501/02/2023 10:26NONOYes
100.3923611110.434722222FALSENOYes
11
12Seconds in a Day:86,400
13Seconds: 60
14One Second in Excel: 0.000011574074074
1560 Seconds: 0.000694444444444
16
17Format: 15 DecimalsFormat: [h]:mm:ss;@Format: 15 DecimalsFormat: h:mm;@
1860 Seconds:0.0000000000000000:00:0060 Minutes:0.0000000000000000:00
190.0000115740740740:00:010.0006944444444440:01
200.0000231481481480:00:020.0013888888888890:02
Sheet1
Cell Formulas
RangeFormula
C3,C5,C7,C9C3=IF(MOD(A3,1)>=MOD(B3,1),"Yes","NO")
D3:D10D3=IF(A3-B3>0.03125, "Yes", "NO")
E3:E10E3=IF(A3-B3<-0.010417, "Yes", "NO")
C4,C6,C8,C10C4=A4>B4
A4:B4,A10:B10,A8:B8,A6:B6A4=MOD(A3,1)
B12B12=60*60*24
B14B14=1/(60*60*24)
B15B15=B14*60
B18:B77B18=SEQUENCE(B13,,0,B14)
C18:C77C18=SEQUENCE(B13,,0,B14)
E18:E77E18=SEQUENCE(60,,0,B15)
F18:F77F18=SEQUENCE(60,,0,B15)
Dynamic array formulas.
Since you have 365, if you paste that into Cell A1 (I always forget to check!), you'll see that the formulas used in Row 18 result in arrays of 60 seconds and 60 minutes. I included the formatting notes because it doesn't come through.
 
Upvote 0
For a single cell, you could put this in cell G3 above and get this:
Book1
GHI
3YesNONO
Sheet1
Cell Formulas
RangeFormula
G3:I3G3=HSTACK(IF(MOD(A3,1)>=MOD(B3,1),"Yes","NO"),IF(A3-B3>0.03125, "Yes", "NO"),IF(A3-B3<-0.010417, "Yes", "NO"))
Dynamic array formulas.
but what's the point?
You could do it in Power Query too, but we won't go there!
 
Upvote 0
Another option

Book5
ABCD
1AppoinementArrivedComment
21/2/2023 9:101/2/2023 8:26On Time
31/2/2023 9:101/2/2023 9:26Late
41/2/2023 9:101/2/2023 8:24Early
5
6
7
Sheet3
Cell Formulas
RangeFormula
C2:C4C2=IF(AND(B2<A2,MAX(A2:B2)-MIN(A2:B2)-INT(MAX(A2:B2)-MIN(A2:B2))>=TIME(0,45,0)),"Early",IF(AND(B2<A2,MAX(A2:B2)-MIN(A2:B2)-INT(MAX(A2:B2)-MIN(A2:B2))<=TIME(0,45,0)),"On Time","Late"))
 
Upvote 0
Another option
Fluff.xlsm
ABCDE
1
202/01/2023 09:1002/01/2023 09:15YNN
302/01/2023 09:1002/01/2023 09:56NYN
402/01/2023 09:3102/01/2023 09:15NNY
Main
Cell Formulas
RangeFormula
C2:C4C2=IF(MEDIAN(A2,B2-TIME(0,45,0),B2+TIME(0,15,0))=A2,"Y","N")
D2:D4D2=IF(A2<B2-TIME(0,45,0),"Y","N")
E2:E4E2=IF(A2>B2+TIME(0,15,0),"Y","N")
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
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