Option Explicit
Function kiemtra(TG As Range)
Dim lr&, i&, rng, start As Double, dur As Double
With Sheets("timeline")
lr = .Cells(Rows.Count, "A").End(xlUp).Row
rng = .Range("A2:B" & lr).Value
End With
For i = 1 To UBound(rng)
start = CDate(Left(rng(i, 1), 10)) + CDate(Right(rng(i, 1), 5))
dur = TimeValue(Replace(Replace(Replace(rng(i, 2), " ", ""), "h", ":"), "min", ""))
If CDate(TG) - start > 0 And CDate(TG) - start <= dur Then
kiemtra = start
Exit Function
End If
Next
kiemtra = "Nam ngoai moc thoi gian"
End Function