Help needed - VLOOKUP based on IF statement, or similar

philobr

Active Member
Joined
Oct 17, 2005
Messages
280
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
Apples Pink Lady 15


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

Any help appreciated, thanks.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
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)
 
Upvote 0
one way


Book1
ABC
1ApplesGranny Smyth20
2ApplesCooking10
3ApplesPink Lady15
4
5
6ApplesCooking10
Sheet14
Cell Formulas
RangeFormula
C6=SUMPRODUCT(--(A1:A3=A6),--(B1:B3=B6),C1:C3)
 
Upvote 0
=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
 
Upvote 0
Something like

Excel 2013/2016
ABCDE
2ApplesGranny Smith20Apples
3ApplesCooking10Cooking
4ApplesBramley1510
Names
Cell Formulas
RangeFormula
E4{=INDEX(C2:C4,MATCH(E2&"|"&E3,A2:A4&"|"&B2:B4,0))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,224,815
Messages
6,181,136
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top