comparing 2 columns info to fill 3rd column

Q

quinn111

I have 2 columns (i.e. origin & destination) & I want it to compare to data
in other part of spreadsheet to fill in miles between origin & destination.

For example: Chicago to Des Moines. I have Chicago in the origin column
and Des Moines in the destination column. I have the miles already
calculated for that run in another part of the spreadsheet, so every time I
fill in the orgin as Chicago & Destination as Des Moines, I want the correct
miles to fill in the mileage column.
 
Q

quinn111

The mileage is just entered into cells, no calculation.
In this example: I have orgin, destination & mileage columns in the same
spreadsheet as the main, just off to the right.
 
P

peter

Try this,
copy this matrix starting in cell c34.

1 2 3 4 5
a 5 6 11 16 21
b 6 7 12 17 22
c 7 8 13 18 23
d 8 9 14 19 24
e 9 10 15 20 25


c 4

18
=OFFSET(C34,MATCH(C42,C35:C39,0),MATCH(D42,D34:H34,0))

peter
 
J

JNW

Try
=sumproduct(--(sheet2!A1:A50=A1),--(sheet2!B1:B50=B1),--(sheet2!C1:C50))

Sheet2 is where the stored distances are.
 
P

Peo Sjoblom

You can shorten that to

=SUMPRODUCT(--(Sheet2!A1:A50=A1),--(Sheet2!B1:B50=B1),Sheet2!C1:C50)


--


Regards,


Peo Sjoblom
 
Q

quinn111

Thanks Peter.
That works, except I changed the values on the formula to absolutes ($) (see
below), but when I copy it, it doesn't work.
Please help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top