hennesseeb
New Member
- Joined
- Dec 30, 2016
- Messages
- 12
I'm working on a file that needs to match up time stamps but from two different data sets. The only data that matches within those two data sets is a 10 digit number. Both sheets are sorted in ascending order so the time stamps will correspond when matched. There's nothing I can concantenate to create a helper column unfortunately. What I'm having trouble with is the match code returning the first match, then when the same digit code appears again, it doesn't pull the same time stamp again, but the second...third..etc. Also, the timestamps between the two data sets may/may not mach, and there should be a gap between them.
I know what needs to happen, but I'm not sure of the exact syntax of how to do it. I need the next match to start on the row below the last match. The number of matches is going to vary, so there's no set number. I'm not sure if this is possible.
Here's what my code looks like now:
I know the syntax isn't right, and I normally don't have to match data like this, but it's the only way to get accurate reports. I hope this doesn't sound too confusing. I've searched around on the internet and I haven't found anything that has really helped me, so I'm reaching out to the board. I appreciate any help/guidance given. Thanks!
I know what needs to happen, but I'm not sure of the exact syntax of how to do it. I need the next match to start on the row below the last match. The number of matches is going to vary, so there's no set number. I'm not sure if this is possible.
Here's what my code looks like now:
Code:
r = Application.CountA(Sheets("Sheet1").Range("A:A"))
For i = 2 To r
ilt = Application.Match(Sheets("Sheet1").Range("A" & i).Value, Sheets("Sheet2").Range("B:B"),0)
If Not IsError(ilt) Then
Sheets("Sheet1").Range("N" & i).Value = Sheets("Sheet2").Range("M" & ilt).Value
End If
ilt = Application.Match(Sheets("Sheet1").Range("A" & i).Value, Sheets("Sheet2").Range("B" & ilt & ":1045876"),0)
Next
I know the syntax isn't right, and I normally don't have to match data like this, but it's the only way to get accurate reports. I hope this doesn't sound too confusing. I've searched around on the internet and I haven't found anything that has really helped me, so I'm reaching out to the board. I appreciate any help/guidance given. Thanks!