# Help needed - VLOOKUP based on IF statement, or similar

#### philobr

##### Active Member
Hi there,
I have a data set and Im trying to look up a specific value based on an initial look up in one column and then a secondary look up in another.

So data would look something like this:

A B C
Apples Granny Smyth 20
Apples Cooking 10

So based on the initial lookup of Apples, then a second lookup of Cooking to give me the total number.

Any help appreciated, thanks.

#### steve the fish

##### Well-known Member
If you want a total sum or there is only one entry of each pair then:

=SUMIFS(C:C,A:A,"Apples",B:B,"Cooking")

Or if you just want the first hit:

=INDEX(\$C\$1:\$C\$100,MATCH(1,INDEX((\$A\$1:\$A\$100="Apples")*(\$B\$1:\$B\$100="Cooking"),0),0))

Or the last hit:

=LOOKUP(2,1/((\$A\$1:\$A\$100="Apples")*(\$B\$1:\$B\$100="Cooking")),\$C\$1:\$C\$100)

one way

#### Special-K99

##### Well-known Member
=INDEX(C\$1:C\$3,MATCH(A6,IF(A\$1:A\$3=A\$5,B\$1:B\$3),0),1)
Array formula, use Ctrl-Shift-Enter

Where A5 is Apples
and A6 is Cooking

#### Fluff

##### MrExcel MVP, Moderator
Something like
<b>Note: Do not try and enter the {} manually yourself</b></td></tr></table><br />

#### philobr

##### Active Member
Brilliant, thanks so much. Appreciate the help.