Hi,
I have been looking and can't seem to get this to work. First, I have two input files that I store into two arrays (Example Below). I need to link a specific event in Array 1 with that in Array 2 and calculate the difference in time. To make it more challenging there may be an event in either array that does not have a corresponding event in the other array. In the example below:
Event A-C occurring at 10:03:12 does not have an accompanying D Event
Event H occurring at 10:04:05 does have an accompanying D event at 10:04:34 (which occurs 29 seconds later).
The criteria to screen this is that the D-event must occur after the event in array 1 and the maximum time later it can occur is MaxDelay.
I want to calculate the time difference and put it in an output array. I am having a heck of a time and can't get the code to obey the above criteria to evaluate which event goes with which D-event. Any tips to point me in the right direction would be greatly appreciated!
Array 1 and 2 are dimmed as date while the output array is dimmed as double. Everything is working up to the point of evaluating the time and associating events.
Array 1
Time Event
10:03:12 PM A-C
10:03:15 PM A-C
10:04:05 PM H
10:04:37 PM H
Array 2
Time Event
10:02:14 PM D
10:04:34 PM D
10:05:10 PM D
Many Thanks!
--David
I have been looking and can't seem to get this to work. First, I have two input files that I store into two arrays (Example Below). I need to link a specific event in Array 1 with that in Array 2 and calculate the difference in time. To make it more challenging there may be an event in either array that does not have a corresponding event in the other array. In the example below:
Event A-C occurring at 10:03:12 does not have an accompanying D Event
Event H occurring at 10:04:05 does have an accompanying D event at 10:04:34 (which occurs 29 seconds later).
The criteria to screen this is that the D-event must occur after the event in array 1 and the maximum time later it can occur is MaxDelay.
I want to calculate the time difference and put it in an output array. I am having a heck of a time and can't get the code to obey the above criteria to evaluate which event goes with which D-event. Any tips to point me in the right direction would be greatly appreciated!
Array 1 and 2 are dimmed as date while the output array is dimmed as double. Everything is working up to the point of evaluating the time and associating events.
Array 1
Time Event
10:03:12 PM A-C
10:03:15 PM A-C
10:04:05 PM H
10:04:37 PM H
Array 2
Time Event
10:02:14 PM D
10:04:34 PM D
10:05:10 PM D
Code:
For k = 0 To UBound(Array1, 2)
Event_Time = Array1(0, k)
For m = 0 To UBound(Array2, 2)
If (Event_Time - Array2(0, m)) > 0 And (Event_Time - Array2(0, m)) < (MaxDelay* 0.0001157407) Then
OutputArray(0, k) = Array1(0, k)
OutputArray(1, k) = Array2(0, m)
OutputArray(2, k) = Array1(0, k) - Array2(0, m)
End If
Next m
Next k
Many Thanks!
--David