View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Tom Hutchins Tom Hutchins is offline
external usenet poster
 
Posts: 1,069
Default Vlookup to look up multiple fields?

If the value you want to return is numeric, you could use SUMPRODUCT:

=SUMPRODUCT(--(Sheet2!$A$2:$A$6=Sheet1!A2),--(Sheet2!$B$2:$B$6=Sheet1!B2),Sheet2!$C$2:$C$6)

In this example, I entered your sample data on Sheet1 and Sheet2 starting in
cell A1. I entered the formula above into cell C2 on Sheet1 and copied down.
The range of rows referenced on Sheet2 needs to be the same for every column.
Adjust the range of rows to fit your data, but you can't reference whole
columns with SUMPRODUCT.

Hope this helps,

Hutch

"Yanick" wrote:

I don't think VLOOKUP can do it but you can CONCATENATE the 2 values together
(should create a unique value) in a new column then do your VLOOKUP.
--
Yanick


"Cam" wrote:

Hello,

Is VLOOKUP function capable of looking at two criteria in the fields and
return the value? If yes, how to put in the code or if not is there any other
way to achieve this? Thanks

Sample:
Sheet1 - data sheet (RESULT column is the vlookup)
Part# Oper RESULT
ABC1 20 50
ABC1 10 30
ABC3 10 30
ABC4 60 40
ABC4 70 100

sheet2 - Reference sheet
Part# Oper Time
ABC1 10 30
ABC1 20 50
ABC3 10 30
ABC4 60 40
ABC4 70 100