Search code examples
excelexcel-formulavlookuplookupxlookup

Lookup values from table


Please I want to write a formula to get the Distance (4th column) between From and To Cities (2nd and 3rd columns) for a particular Order ID (1st column) in Table 1 while looking up data from the Distances worksheet as shown below.

Table 1

Distances worksheet: Distances worksheet


Solution

  • So a quick version:

    INDEX(A2:D5,MATCH(B8,A2:A5,0),MATCH(B9,A2:D2,0))
    

    enter image description here

    B8 is the starting point, B9 end. Did not repeat all your data as you gave it as a picture and I am too lazy to type all of that.