View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.newusers
ben ben is offline
external usenet poster
 
Posts: 22
Default vlookup with 2 columns?

So far I have just been experimenting with the first option and it works. I
am not familiar enough with the notation to know why though. A1:A4 and B1:B4
define the range (array) of cells I want checked and putting the array = to
something implies a condition matching the cell I want. What does the '--'
before the condition mean? From what I read on SUMPRODUCT each array needs
to be the same size, but I would have thought that the below example may
have them not being the same size unless the '--' has something to do with
it. Would you be able to clarify this for me?

Thanks,
Bn

T. Valko wrote:
If the data to return is numeric as is demonstrated in your sample *and* the
combination of A1+X2 is unique:

=SUMPRODUCT(--(A1:A4="A1"),--(B1:B4="X2"),C1:C4)

Or, this generic version works for any data type.

Array entered** :

=INDEX(C1:C4,MATCH(1,(A1:A4="A1")*(B1:B4="X2"),0))

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)