Comparing 2 Tables and Pulling Row from 1 Into the Other If it Takes Place within 20 Minutes AFTER the original date/time stamp

  • Thread starter Thread starter Legacy 367570
  • Start date Start date
L

Legacy 367570

Guest
Hi All,

Bit of a complicated one. Any help much appreciated!!!

So I have two sets of data I want to link together.


Both have time stamps in format mm/dd/yyyy hh:mm in each row.


I for each row in table 1, I want to look at the time stamp, then return the details of the row in table 2 that occurs within 20 minutes AFTER the date and time stamp in table 1. The formula should ONLY return the row with the highest value based on another column


So

Table 1


[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD="align: center"]Name[/TD]
[TD="align: center"]Time[/TD]
[TD="align: center"]Output Data 1[/TD]
[TD="align: center"]Output Data 2[/TD]
[TD="align: center"]Output Data 3[/TD]
[/TR]
[TR]
[TD="align: center"]John[/TD]
[TD="align: center"]02/02/2016 08:45:00[/TD]
[TD][TABLE="width: 97"]
<tbody>[TR]
[TD="class: xl65, width: 97, align: center"]?[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="align: center"]?[/TD]
[TD="align: center"]?[/TD]
[/TR]
[TR]
[TD][TABLE="width: 55"]
<tbody>[TR]
[TD="class: xl65, width: 55, align: center"]Luke[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 113"]
<tbody>[TR]
[TD="class: xl66, width: 113, align: center"]02/08/2016 06:00[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="align: center"]?[/TD]
[TD="align: center"]?[/TD]
[TD="align: center"]?[/TD]
[/TR]
[TR]
[TD][TABLE="width: 55"]
<tbody>[TR]
[TD="class: xl65, width: 55, align: center"]Sarah[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 113"]
<tbody>[TR]
[TD="class: xl65, width: 113, align: center"]02/15/2016 12:52[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="align: center"]?[/TD]
[TD="align: center"]?[/TD]
[TD="align: center"]?[/TD]
[/TR]
[TR]
[TD][TABLE="width: 55"]
<tbody>[TR]
[TD="class: xl65, width: 55, align: center"]Ben[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 113"]
<tbody>[TR]
[TD="class: xl65, width: 113, align: center"]02/20/2016 21:45[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="align: center"]?[/TD]
[TD="align: center"]?[/TD]
[TD="align: center"]?[/TD]
[/TR]
</tbody>[/TABLE]

Table 2


[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD][TABLE="width: 55"]
<tbody>[TR]
[TD="class: xl65, width: 55, align: center"]Product[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 113"]
<tbody>[TR]
[TD="class: xl65, width: 113, align: center"]Time[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 97"]
<tbody>[TR]
[TD="class: xl65, width: 97, align: center"]Value[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 130"]
<tbody>[TR]
[TD="class: xl65, width: 130, align: center"]Additional Value 1[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 130"]
<tbody>[TR]
[TD="class: xl65, width: 130, align: center"]Additional Value 2[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 130"]
<tbody>[TR]
[TD="class: xl65, width: 130, align: center"]Additional Value 3[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 55"]
<tbody>[TR]
[TD="class: xl65, width: 55, align: center"]Apple[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 113"]
<tbody>[TR]
[TD="class: xl65, width: 113, align: center"]02/15/2016 08:55[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 97"]
<tbody>[TR]
[TD="class: xl65, width: 97, align: center"]5.665[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="align: center"]a[/TD]
[TD="align: center"]6[/TD]
[TD="align: center"]r[/TD]
[/TR]
[TR]
[TD][TABLE="width: 55"]
<tbody>[TR]
[TD="class: xl65, width: 55, align: center"]Orange[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 113"]
<tbody>[TR]
[TD="class: xl65, width: 113, align: center"]02/20/2016 06:08[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 97"]
<tbody>[TR]
[TD="class: xl65, width: 97, align: center"]3.874[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]w[/TD]
[TD="align: center"]x[/TD]
[/TR]
[TR]
[TD][TABLE="width: 55"]
<tbody>[TR]
[TD="class: xl65, width: 55, align: center"]Pear[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 113"]
<tbody>[TR]
[TD="class: xl66, width: 113, align: center"]02/02/2016 12:58[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 97"]
<tbody>[TR]
[TD="class: xl65, width: 97, align: center"]9.254[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD][TABLE="width: 55"]
<tbody>[TR]
[TD="class: xl65, width: 55, align: center"]Water[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 113"]
<tbody>[TR]
[TD="class: xl66, width: 113, align: center"]02/08/2016 22:02[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 97"]
<tbody>[TR]
[TD="class: xl65, width: 97, align: center"]2.987[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]![/TD]
[TD="align: center"]=[/TD]
[/TR]
[TR]
[TD][TABLE="width: 55"]
<tbody>[TR]
[TD="class: xl65, width: 55, align: center"]Soda[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 113"]
<tbody>[TR]
[TD="class: xl66, width: 113, align: center"]02/08/2016 21:56[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 97"]
<tbody>[TR]
[TD="class: xl65, width: 97, align: center"]1.157[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="align: center"]d[/TD]
[TD="align: center"]w[/TD]
[TD="align: center"]d[/TD]
[/TR]
[TR]
[TD][TABLE="width: 55"]
<tbody>[TR]
[TD="class: xl65, width: 55, align: center"]Coke[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 113"]
<tbody>[TR]
[TD="class: xl65, width: 113, align: center"]02/20/2016 06:18[/TD]
[/TR]
</tbody>[/TABLE]

[/TD]
[TD][TABLE="width: 97"]
<tbody>[TR]
[TD="class: xl65, width: 97, align: center"]3.997[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]3[/TD]
[/TR]
</tbody>[/TABLE]



Output

[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD][TABLE="width: 55"]
<tbody>[TR]
[TD="class: xl65, width: 55, align: center"]Name[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="align: center"]Time[/TD]
[TD="align: center"]Product[/TD]
[TD="align: center"]Time[/TD]
[TD="align: center"]Value[/TD]
[TD][TABLE="width: 130"]
<tbody>[TR]
[TD="class: xl65, width: 130, align: center"]Additional Value 1[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 130"]
<tbody>[TR]
[TD="class: xl65, width: 130, align: center"]Additional Value 2[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 130"]
<tbody>[TR]
[TD="class: xl65, width: 130, align: center"]Additional Value 3[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD="align: center"]John[/TD]
[TD][TABLE="width: 113"]
<tbody>[TR]
[TD="class: xl66, width: 113, align: center"]02/02/2016 08:45[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 97"]
<tbody>[TR]
[TD="class: xl65, width: 97, align: center"]Apple[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 130"]
<tbody>[TR]
[TD="class: xl65, width: 130, align: center"]02/15/2016 08:55[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 130"]
<tbody>[TR]
[TD="class: xl65, width: 130, align: center"]5.665[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="align: center"]a[/TD]
[TD="align: center"]6[/TD]
[TD="align: center"]r[/TD]
[/TR]
[TR]
[TD="align: center"]Luke[/TD]
[TD][TABLE="width: 113"]
<tbody>[TR]
[TD="class: xl66, width: 113, align: center"]02/08/2016 06:00[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 97"]
<tbody>[TR]
[TD="class: xl65, width: 97, align: center"]Coke[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 130"]
<tbody>[TR]
[TD="class: xl65, width: 130, align: center"]02/20/2016 06:18[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 130"]
<tbody>[TR]
[TD="class: xl65, width: 130, align: center"]3.997[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]Sarah[/TD]
[TD][TABLE="width: 113"]
<tbody>[TR]
[TD="class: xl65, width: 113, align: center"]02/15/2016 12:52[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 97"]
<tbody>[TR]
[TD="class: xl65, width: 97, align: center"]Pear[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 130"]
<tbody>[TR]
[TD="class: xl66, width: 130, align: center"]02/02/2016 12:58[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 130"]
<tbody>[TR]
[TD="class: xl65, width: 130, align: center"]9.254[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]Ben[/TD]
[TD][TABLE="width: 113"]
<tbody>[TR]
[TD="class: xl65, width: 113, align: center"]02/20/2016 21:45[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 97"]
<tbody>[TR]
[TD="class: xl65, width: 97, align: center"]Water[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 130"]
<tbody>[TR]
[TD="class: xl66, width: 130, align: center"]02/08/2016 22:02[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 130"]
<tbody>[TR]
[TD="class: xl65, width: 130, align: center"]2.987[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]![/TD]
[TD="align: center"]=[/TD]
[/TR]
</tbody>[/TABLE]


As you can see above, each of the returned rows are within 20 minutes after the original, and for Ben and Luke, return the rows with the highest value.


Any ideas on how I can achieve this?


Thanks in advance!
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Forum statistics

Threads
1,223,243
Messages
6,170,964
Members
452,371
Latest member
Frana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top