Hello All,

I would like to use lookup function.

Usually the Vlookup would lookup the first instance the lookup value
comes across. eg data set.

Name Container Type
--------- -------------- ---------
John A 34
John B 45
John C 44
Peter A 67
Peter B 77

Now if I do a look up for John and Peter, the unique value would be
always 34 and 67

Now suppose I have another sheet where the type is requried as a
function then it would always use 34 and 67 for John and Peter.

How do I use a Vlookup with 2 conditions ie If Name is John and
Container is A then it would use 34, else it would us John and B .

Would appreciate any help.

thanks
SD

Re: Lookup by Dave

Dave
Mon May 05 06:07:27 CDT 2008

Saved from a previous post:

If you want exact matches for just two columns (and return a value from a
third), you could use:

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

(all in 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 only use the whole column in xl2007.

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!$d$1:$d$100,
match(1,(a2=othersheet!$a$1:$a$100)
*(b2=othersheet!$b$1:$b$100)
*(c2=othersheet!$c$1:$c$100),0))

SD wrote:
>
> Hello All,
>
> I would like to use lookup function.
>
> Usually the Vlookup would lookup the first instance the lookup value
> comes across. eg data set.
>
> Name Container Type
> --------- -------------- ---------
> John A 34
> John B 45
> John C 44
> Peter A 67
> Peter B 77
>
> Now if I do a look up for John and Peter, the unique value would be
> always 34 and 67
>
> Now suppose I have another sheet where the type is requried as a
> function then it would always use 34 and 67 for John and Peter.
>
> How do I use a Vlookup with 2 conditions ie If Name is John and
> Container is A then it would use 34, else it would us John and B .
>
> Would appreciate any help.
>
> thanks
> SD

--

Dave Peterson