Hello All:
I can't seem to get the right code to deliver cells from either my Vlookup or Index/Match functions on matching dates & times.
The point of the code is to use a date/time from one list (thousands long), look for a match in another list (thousands long), and pull in data from the column next to it in the same row. I have used vlookup many times for looking up data before, but the problem is that if the Data table has multiple entries on the same date/time (this is certainly will happen for my data) the Vlookup and Index/Match functions return only the first entry, at least how I have it coded right now.
I attached a spreadsheet illustrating what I tried with Index/Match and Vlookup, and also have it reprinted in text below.
Any coding tips to bring in data from multiple rows with identical matching lookup criteria (like date & time) would be greatly appreciated!
Index/Match trial:
DATA TABLE
Timestamp_1 Key1 Motor1 Amount1
7/20/09 1:34:54 AM 105 1 730
7/20/09 1:35:04 AM 103 1 260
7/20/09 2:19:34 AM 105 1 255
7/20/09 2:19:34 AM 103 2 705
7/20/09 2:19:34 AM 105 1 -515
7/20/09 2:19:36 AM 105 1 -220
7/20/09 2:19:41 AM 103 1 -835
CHECK TABLE
Timestamp_2 Key1 (code is in attached spreadsheet & below)
7/20/09 1:35:04 AM is 103
7/20/09 1:35:05 AM #N/A
7/20/09 1:35:06 AM #N/A
7/20/09 1:35:07 AM #N/A
7/20/09 2:19:33 AM #N/A
7/20/09 2:19:34 AM is 105
7/20/09 2:19:34 AM is 105
7/20/09 2:19:34 AM is 105
7/20/09 2:19:41 AM is 103
Key1 code: =IF(INDEX($A$3:$D$9,MATCH(A13,$A$3:$A$9,0),2)=103,"is 103",IF(INDEX($A$3:$D$9,MATCH(A13,$A$3:$A$9,0),2)=105,"is 105","not 103 or 105"))
Vlookup trial:
DATA TABLE
Timestamp_1 Key1 Motor1 Amount1
7/20/09 1:34:54 AM 105 1 730
7/20/09 1:35:04 AM 103 1 260
7/20/09 2:19:34 AM 105 1 255
7/20/09 2:19:34 AM 103 2 705
7/20/09 2:19:34 AM 105 1 -515
7/20/09 2:19:36 AM 105 1 -220
7/20/09 2:19:41 AM 103 1 -835
CHECK TABLE
Timestamp_2 Key1 (code is in attached spreadsheet)
7/20/09 1:35:04 AM is 103
7/20/09 1:35:05 AM is 103
7/20/09 1:35:06 AM is 103
7/20/09 1:35:07 AM is 103
7/20/09 2:19:33 AM is 103
7/20/09 2:19:34 AM is 105
7/20/09 2:19:34 AM is 105
7/20/09 2:19:34 AM is 105
7/20/09 2:19:41 AM is 103
Key1 code: =IF(VLOOKUP(A13,$A$3:$D$9,2)=103,"is 103",IF(VLOOKUP(A13,$A$3:$D$9,2)=105,"is 105","not 103 or 105"))
Bookmarks