Formula Locating Common Value

ReaperX

New Member
Joined
Oct 25, 2012
Messages
12
Hello,

I have a table with two columns of airports. Column 1 is the originating, and column 2 is the destination. Each airport is listed multiple times in each column. I have a formula that can find if a direct flight is possible, but I am looking for a formula that can find connections. As an example, I know Madison flies to Chicago, and I know Chicago flies to Little Rock. How can I find that Chicago is the connecting flight between Madison and Little Rock? I know some of these will have multiple connections, which I can try and figure out, but at least the first possible one should populate.

My data is set up as follows:
OriginDestination
MADISONLAS VEGAS
MADISONCHICAGO
MADISONATLANTA
MADISONBOSTON
CHICAGOMADISON
CHICAGOLITTLE ROCK
CHICAGOPHOENIX
LITTLE ROCKSEATTLE
LITTLE ROCKCHICAGO

<TBODY>
</TBODY>

Any help is appreciated.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Hello,

I have a table with two columns of airports. Column 1 is the originating, and column 2 is the destination. Each airport is listed multiple times in each column. I have a formula that can find if a direct flight is possible, but I am looking for a formula that can find connections. As an example, I know Madison flies to Chicago, and I know Chicago flies to Little Rock. How can I find that Chicago is the connecting flight between Madison and Little Rock? I know some of these will have multiple connections, which I can try and figure out, but at least the first possible one should populate.

My data is set up as follows:
OriginDestination
MADISONLAS VEGAS
MADISONCHICAGO
MADISONATLANTA
MADISONBOSTON
CHICAGOMADISON
CHICAGOLITTLE ROCK
CHICAGOPHOENIX
LITTLE ROCKSEATTLE
LITTLE ROCKCHICAGO

<tbody>
</tbody>

Any help is appreciated.

Is this a finite list of desitantion or you have more and more...
What answer do you expect for each of the line?
 
Upvote 0
The list is much longer and could change. The results are not part of that table at all. I have two dropdowns that allow me to choose departure airport and destination airport. When they don't have direct flights, I would like a cell to return a common flight. All of the flights in the list are reversible (i.e. Little Rock to Seattle is also Seattle to Little Rock). If it can populate a list of ALL common flights, that would be great too, but I really just need the first one that comes up.
 
Upvote 0
Hi,

If I follow, try this...

Set up:

*ABCDEF
1OriginDestination*OriginDestinationConnecting Flights
2MADISONLAS VEGAS*MADISONLITTLE ROCKCHICAGO
3MADISONCHICAGO*MADISONLITTLE ROCKLAS VEGAS
4MADISONATLANTA****
5MADISONBOSTON****
6CHICAGOMADISON****
7CHICAGOLITTLE ROCK****
8CHICAGOPHOENIX****
9LITTLE ROCKSEATTLE****
10LAS VEGASLITTLE ROCK****

<tbody>
</tbody>

Array formula in F2 is:

Code:
=INDEX(B$2:B$10,MATCH(1,IF(A$2:A$10=D2,IF(B$2:B$10=INDEX(A$2:A$10,SMALL(IF(B$2:B$10=E2,ROW(B$2:B$10)-ROW(B$2)+1),ROWS(F$2:F2))),1)),0))

Which requires entry with CTRL+SHIFT+ENTER and can then be copied down...

Does it do as desired?

Matty
 
Upvote 0

Forum statistics

Threads
1,217,108
Messages
6,134,674
Members
449,883
Latest member
Jedi Master

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