Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
pinpalchris
 
Posts: n/a
Default How do I use vlookup with two lookup values?

Hi,
I tried most of the posts for vlookup, but wasn't successful. Here's my
problem:
I have 2 values in the same row in table2 (cells A5 and B5), for which I'd
like to look up the matching row in table 1, which has a different structure.
The formula should return the value of column 6 of the matching row in
table1. Example:

table2:
A=Origin B=Destination C=rate
Singapore Vancouver (lookup result)

table1:
A=Origin B=Destination F=rate
Tokyo Vancouver $200
Singapore Vancouver $100
Singapore Seattle $150

Does anybody have a suggestion? Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson
 
Posts: n/a
Default How do I use vlookup with two lookup values?

=index(othersheet!$f$1:$f$100,
match(1,(a2=othersheet!$a$1:$a$100)*(b2=othersheet !$b$1:$b$100),0))
(one cell)

This is an array formula. Hit ctrl-shift-enter instead of enter. If you do it
correctly, excel will wrap curly brackets {} around your formula. (don't type
them yourself.)

Adjust the range to match--but you can't use the whole column.

This returns the value in othersheet column C when column A and B (of
othersheet) match A2 and B2 of the sheet with the formula.

And you can add more conditions by just adding more stuff to that product
portion of the formula:

=index(othersheet!$f$1:$f$100,
match(1,(a2=othersheet!$a$1:$a$100)
*(b2=othersheet!$b$1:$b$100)
*(c2=othersheet!$c$1:$c$100),0))

pinpalchris wrote:

Hi,
I tried most of the posts for vlookup, but wasn't successful. Here's my
problem:
I have 2 values in the same row in table2 (cells A5 and B5), for which I'd
like to look up the matching row in table 1, which has a different structure.
The formula should return the value of column 6 of the matching row in
table1. Example:

table2:
A=Origin B=Destination C=rate
Singapore Vancouver (lookup result)

table1:
A=Origin B=Destination F=rate
Tokyo Vancouver $200
Singapore Vancouver $100
Singapore Seattle $150

Does anybody have a suggestion? Thanks.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
 
Posts: n/a
Default How do I use vlookup with two lookup values?


pinpalchris wrote:
Hi,
I tried most of the posts for vlookup, but wasn't successful. Here's my
problem:


Best way is to concatenate both criteria in a temporary column and use
the normal vlookup function

ColumnA | ColumnB | ColumnC | ColumnD
Tokyo | Vancouver | TokyoVancouver | 200
Singapore | Vancouver | SingaporeVancouver | 100
Singapore | Seattle | SingaporeSeattle | 150

I have separated columns by " | " symbol

Now I have added a temporary column in column C.
Formula in C2 should be =CONCATENATE(A2,B2)
Formula in C3 should be =CONCATENATE(A3,B3)
Formula in C4 should be =CONCATENATE(A4,B4)

Now if A7 has "Singapore" and B7 has "Vancouver" and if you want to
find the rate in D7, then use this formula,

=VLOOKUP(CONCATENATE(A7,B7),C1:D4,2,FALSE)

Sandy

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
pinpalchris
 
Posts: n/a
Default How do I use vlookup with two lookup values?

Hi Dave,

thanks, this worked perfectly! My problem's solved.

Have a good one,

Chris

"Dave Peterson" wrote:

=index(othersheet!$f$1:$f$100,
match(1,(a2=othersheet!$a$1:$a$100)*(b2=othersheet !$b$1:$b$100),0))
(one cell)

This is an array formula. Hit ctrl-shift-enter instead of enter. If you do it
correctly, excel will wrap curly brackets {} around your formula. (don't type
them yourself.)

Adjust the range to match--but you can't use the whole column.

This returns the value in othersheet column C when column A and B (of
othersheet) match A2 and B2 of the sheet with the formula.

And you can add more conditions by just adding more stuff to that product
portion of the formula:

=index(othersheet!$f$1:$f$100,
match(1,(a2=othersheet!$a$1:$a$100)
*(b2=othersheet!$b$1:$b$100)
*(c2=othersheet!$c$1:$c$100),0))

pinpalchris wrote:

Hi,
I tried most of the posts for vlookup, but wasn't successful. Here's my
problem:
I have 2 values in the same row in table2 (cells A5 and B5), for which I'd
like to look up the matching row in table 1, which has a different structure.
The formula should return the value of column 6 of the matching row in
table1. Example:

table2:
A=Origin B=Destination C=rate
Singapore Vancouver (lookup result)

table1:
A=Origin B=Destination F=rate
Tokyo Vancouver $200
Singapore Vancouver $100
Singapore Seattle $150

Does anybody have a suggestion? Thanks.


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
pinpalchris
 
Posts: n/a
Default How do I use vlookup with two lookup values?

Thanks for your help Sandy!

Very much appreciated!

Have a nice day,

Chris

" wrote:


pinpalchris wrote:
Hi,
I tried most of the posts for vlookup, but wasn't successful. Here's my
problem:


Best way is to concatenate both criteria in a temporary column and use
the normal vlookup function

ColumnA | ColumnB | ColumnC | ColumnD
Tokyo | Vancouver | TokyoVancouver | 200
Singapore | Vancouver | SingaporeVancouver | 100
Singapore | Seattle | SingaporeSeattle | 150

I have separated columns by " | " symbol

Now I have added a temporary column in column C.
Formula in C2 should be =CONCATENATE(A2,B2)
Formula in C3 should be =CONCATENATE(A3,B3)
Formula in C4 should be =CONCATENATE(A4,B4)

Now if A7 has "Singapore" and B7 has "Vancouver" and if you want to
find the rate in D7, then use this formula,

=VLOOKUP(CONCATENATE(A7,B7),C1:D4,2,FALSE)

Sandy


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Advanced Lookup (lookup for 2 values) 0-0 Wai Wai ^-^ Excel Worksheet Functions 2 March 30th 06 07:09 PM
Vlookup doesn't work until i edit(but not change) the lookup cell Confused Excel Worksheet Functions 4 November 8th 05 09:15 AM
vlookup with 2 values NITESH G Excel Discussion (Misc queries) 2 November 8th 05 08:24 AM
How can I use the vlookup function to return a sum of the values? Chaandni Excel Discussion (Misc queries) 4 November 7th 05 03:05 PM
VLookup to sum cell values Zakynthos Excel Worksheet Functions 4 July 26th 05 12:05 PM


All times are GMT +1. The time now is 10:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"