View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Roger Govier
 
Posts: n/a
Default Returning a distance from a tabel, given "from" and "To"?

Hi Max

I would start by creating some named ranges using InsertNameDefine.
Firstly create a range called Table, encompassing the whole of your data
set.
Then create a range called To using the top row of the table, and a
range called From using the first column of the table.

Then with the name of the Source in A1 and the Destination in A2, in
cell A3 enter
=INDEX(Table,MATCH(A1,From,0),MATCH(A2,To,0))

--
Regards

Roger Govier


"Max" wrote in message
...
I cannot find a way to return (for instance) the distance in the 3rd
column
of a distance table, for a whole series of "From" - "To" iternies in
another
tabel. These "from"and "to" fields are text-values in 2 different
columns.
For each combination, I want to test whether there is a distance in
the table
for this iterny, and if so, return that distance.

The VLookup can only check 1 criteria (or at least I can..) and there
might
also be multiple (but unknown numbers) destinations from 1 origin.

I thought of making one text-string out of the "to" and "from" and
VLookup
that string, but I imagine there is a more elegant solution to this!

Regards and thanks in advance!

Max