Formula Lookup Multiple Distance

decent_boy

Board Regular
Joined
Dec 5, 2014
Messages
130
Office Version
  1. 2016
Platform
  1. Windows
Hi All

Actually I need a formula which lookup multiple distance from given below table when I select origin and destination it gives me result as per given below result table.


Destination Touch Points​

Origin
ABCDE
A050100200400
B50050100200
C100500100100
D200100100050
E400200100500

<tbody>
</tbody>


Required Result through formula

If i select origin and destination from below than formula gives result as mentioned in below result table

Selection Example
originDestination
AE

<tbody>
</tbody>





Result By Formula
AreaKM
B50
C100
D200
E400

<tbody>
</tbody>
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Excel 2010
ABCDEF
1Origin
2ABCDE
3A050100200400
4B50050100200
5C100500100100
6D200100100050
7E400200100500
8
9
10
11
12OriginA
13
14DestinationDistance
15B50
16C100
17D200
18E400
Sheet1
Cell Formulas
RangeFormula
B15=INDEX($B$3:$F$7,MATCH($B$12,$A$3:$A$7,0),MATCH($A15,$B$2:$F$2,0))
 
Upvote 0
Comfy thanks for your reply, but there is confusion here because you keep only Origin but i have to select origin and destination both for example if select origin e and destination a then what will happen ?
 
Upvote 0
If you select origin e and destination a it will return 400 as per your table.
 
Upvote 0
If I select origin e and destination a then table looks like (E to A transportation movement)

AreaKM
D50
C100
B200
A400

<tbody>
</tbody>
 
Upvote 0
if it can not be solved through formula , can it be solved through VB or any other solution
 
Upvote 0
Based on "Comfy's" layout, try this UDF
After pasteing in Basic module , use in "B15" down as :- =Kg(A15)
Code:
Function Kg(Des As Range) As Double
Dim RngAc As Range, RngRw As Range, Dic As Object, oGin As Range
Dim Rw As Range, Ac As Range
Application.Volatile
Set oGin = Range("B12")
Set RngAc = Range("B2:F2"): Set RngRw = Range("A3:A7")
Set Dic = CreateObject("scripting.dictionary")
Dic.CompareMode = vbTextCompare
For Each Rw In RngRw
    For Each Ac In RngAc
      Dic(Rw.Value & "," & Ac.Value) = Cells(Rw.Row, Ac.Column)
    Next Ac
Next Rw
Kg = Dic(oGin & "," & Des)
End Function
 
Upvote 0

Forum statistics

Threads
1,214,657
Messages
6,120,773
Members
448,991
Latest member
Hanakoro

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