index match miles

methody

Well-known Member
Joined
Jun 17, 2002
Messages
857
Hello there
I have a table with Town A, Town B, town C etc down the left hand column and the same towns along the top row. Within the table I have entered the distance from one town to the other. I am looking for the biggest distance and I use MAX. But now want to find the names of the towns which are furthest apart.
I am playing about with index match but I can't get it
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Thank you that's brilliant

I know I'm pushing it but would there be an easy way of adjusting the formula to find the second longest journey rather than the longest.

Aladin thanks for yours too. It worked perfectly although I am likely to be dealing with a large number of towns so it was going to be easier to use fewer formula
 
Upvote 0
Thank you that's brilliant

I know I'm pushing it but would there be an easy way of adjusting the formula to find the second longest journey rather than the longest.

Try:

=INDEX(E4:J4,LARGE((ISNUMBER(SEARCH(MAX(E5:J10),E5:J10)))*(COLUMN(E5:J10)-COLUMN($D$5)),3))
 
Upvote 0
Not quite it yet
The answer on my example should be
portrush donaghadee
aaTop 1 MaxAssociates methody.xls
ABCDEFG
1bangordonaggroobelastportrushballymena
2bangor62126030
3donag64186666
4groo24146232
5belast1218145025
6portrush6066625020
7ballymena3066322520
8
9
10
1166
122
13donagballymena
14donagportrush
15
Sheet2


A11:

=MAX(B2:G7)

A12:

=COUNTIF(B2:G7,A11)/2

A13:

=IF(ROWS($B$13:B13)<=A$12,INDEX($A$2:$A$7,SMALL(IF($B$2:$G$7=A$11,ROW($B$2:$G$7)-ROW($B$2)+1),ROWS($B$13:B13))),"")

Confirmed with control+shift+enter and copied down.

B13:

=IF(ROWS($B$13:B13)<=A$12,INDEX($B$1:$G$1,LARGE(IF($B$2:$G$7=A$11,COLUMN($B$2:$G$7)-COLUMN($B$2)+1),ROWS($B$13:B13))),"")

Confirmed with control+shift+enter and copied down.
 
Upvote 0
Hello Aladin

I don' want to cause offence to NBVC but think I'm coming round to your way because it seems to deal with the poossibility of there being two distances the same. Although how woud I deal with the second highest? Would I have to adjust the LARGE element of the formula?
 
Upvote 0
Upvote 0
I'm becoming a bit of a pest. I've post myexample. In the example there are two journeys of 67 miles -donag to armagh and donag to portrush. The value in cell E19 should be 'donag'. Can you see why it isn't

...

Not your fault. The setup is simply not good enough. The remedy is to leave empty the cells below the diagonal. Can we go with that?
 
Upvote 0
I'm becoming a bit of a pest. I've post myexample. In the example there are two journeys of 67 miles -donag to armagh and donag to portrush. The value in cell E19 should be 'donag'. Can you see why it isn't
...

If you leave below diagonal empty...
Copy of fixtrial2 methody.xls
DEFGHIJKLM
5xxbangordonaggroobelastportrushballymenaarmagh
6bangor6212603056
7donag418673667
8groo14623259
9belast502545
10portrush2067
11ballymena45
12armagh
13
14
15
1667
173
18donagarmagh
19donagportrush
20portrusharmagh
21  
a2


D16:

=MAX(F6:M14)

D17:

=COUNTIF(F6:M14,D16)

D18:

=IF(ROWS(D$18:D18)<=D$17,INDEX($D$6:$D$14,SMALL(IF($F$6:$M$14=D$16,ROW($F$6:$M$14)-ROW($F$6)+1),ROWS(E$18:E18))),"")

confirmed with control+shift+enter and copied down.

E18:

=IF(ROWS(E$18:E18)<=D$17,INDEX($F$5:$M$5,LARGE(IF($F$6:$M$14=D$16,IF($D$6:$D$14=$D18,COLUMN($F$6:$M$14)-COLUMN($F$6)+1)),COUNTIF($D$18:D18,D18))),"")

confirmed with control+shift+enter and copied down.
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,732
Members
448,987
Latest member
marion_davis

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