Unique Problem - MATCH and INDEX help please!

sgreenprice

New Member
Joined
Sep 21, 2017
Messages
6
Good Afternoon,
bCrook


I have a database which contains Loop ID Points along a tram line, and am trying to find the average travel time difference between two Loop Points. (See Image 1) https://ibb.co/bCrook

I have gotten as far as extracting Tram ID's from the database on a given loop, and on each Tram ID have extracted the tram times where the Loop ID is triggered. (See Image 2) https://ibb.co/iEvsEQ

I have also written a formula that returns only Tram ID's that exists in both lists returned by the filter. (See Image 3) https://ibb.co/ky5sEQ

The final step is extracting the calculated difference in time between the two Loop Points inputted (as the data is anomalous, e.g. the Tram ID or Times are not necessarily mirrored between Loop ID 1 and Loop ID 2. Ideally we would only return time differences under 40 minutes or the closest time to it (so we are making sure it is the same tram being returned).

If anyone has any ideas on how to make it work, I'd appreciate any advice! :LOL:
 
Last edited by a moderator:

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hi,

If that's enough to just look at the second table and check for each entry what is the first entry within 40 minutes for the same tram in the first table you can do that with this formula

=IF(B16<>"",IFERROR(INDEX($B1:$J1,,MATCH(1,IF($B1:$J1-B16<1/24/60*40,1,0)*IF($B1:$J1-B16>0,1,0),0))-B16,"not found"),"")

This goes in first line, first entry of the new time difference table,
B16 is the first line, first entry in the second table
$B1:$J1 is the first line in the first table
then drag across and down
 
Upvote 0

Forum statistics

Threads
1,216,180
Messages
6,129,341
Members
449,505
Latest member
Alan the procrastinator

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