sherbetdab
New member
I have a sheet with columns for a planned arrival time window, I have a cell with actual arrival time.
I have to work out if the actual arrival time is within the planned arrival time window.
All is going well until i have times which span 2 days.
Actual arrival is 23:00 in cell D1
Earliest arrival is 22:00 in cell B1
Latest arrival is 01:00 in cell C1
The code returns Not, No and Late but i need it to return On Time, No and No
Can anyone help me out?
I have to work out if the actual arrival time is within the planned arrival time window.
All is going well until i have times which span 2 days.
Actual arrival is 23:00 in cell D1
Earliest arrival is 22:00 in cell B1
Latest arrival is 01:00 in cell C1
The code returns Not, No and Late but i need it to return On Time, No and No
Can anyone help me out?
Code:
With Range("E1:E" & LastRow)
.Formula = "=IF(AND(D1>=B1,D1<=C1),""On Time"",""Not"")"
.Value = .Value
End With
With Range("F1:F" & LastRow)
.Formula = "=IF(D1<B1,""Early"",""No"")"
.Value = .Value
End With
With Range("G1:G" & LastRow)
.Formula = "=IF(D1>C1,""Late"",""No"")"
.Value = .Value
End With
Last edited: