Vlookup/sumproduct for two or more criteria

Vanda_a

Well-known Member
Joined
Oct 29, 2012
Messages
934
Dear all

Could you guy help me out with the VLOOKUP. below are the table i would like to use the VLOOKUP.
NumACNameNum
1
11002ABC1
Apple
How to vlookup Num and meet the criteria 42 of column AC then extract value of Name
111001BCA2Orange
1
42001
Apple
3Mango
211002ABC
211001BCA
2
42002
Orange
311003ABC
311005BCA
3
42005
Mango

<tbody>
</tbody>
Case 2. Sumproduct with two and more criteria. Note : the formula working with only two criteria.
I dont know how to add more criteria and sum two column C and D
ABCDEFG
1NumACDrCrCodeNum42001
2111002100T1=sumproduct((A2:A15=G2)*(B2:B15=H1)*(E2:E15="T"),C2:D15)
3111001100N2
4142001200T3
514200120N
6
7211002100T
8211001100N
9242002200T
1024200220N
11
12311003100T
13311005100N
14342005200T
1534200520N

<tbody>
</tbody>
Thank you very much
 
Last edited:

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Try:

ABCDEFGHIJAC
1NumACNameNumcriteria
2111002ABC1AppleHow to vlookup Num and meet the criteria 42 of column AC then extract value of Name42
3111001BCA2Orange
4142001Apple3Mango
5
6211002ABC
7211001BCA
8242002Orange
9
10311003ABC
11311005BCA
12342005Mango

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet3

Array Formulas
CellFormula
F2{=INDEX($C$2:$C$12,MATCH(E2&"|"&$AC$2,$A$2:$A$12&"|"&LEFT($B$2:$B$12,LEN($AC$2)),0))}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>




Case 2:

ABCDEFGH
1NumACDrCrCodeNum42001
2111002100T1200
3111001100N20
4142001200T30
514200120N
6
7211002100T
8211001100N
9242002200T
1024200220N
11
12311003100T
13311005100N
14342005200T
1534200520N

<tbody>
</tbody>
Sheet4

Worksheet Formulas
CellFormula
H2=SUMPRODUCT(($A$2:$A$15=G2)*($B$2:$B$15=$H$1)*($E$2:$E$15="T"),($C$2:$C$15+$D$2:$D$15))

<tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0

Good morning. For sumproduct i tried but it not working. why?
Code:
=SUMPRODUCT(('JL All'!F:F='P&L Detail for Tax'!D9)*('JL All'!Q:Q="VAT10")*('JL All'!Q:Q="WHT10")*('JL All'!Q:Q="WHT14"),('JL All'!I:I))
 
Upvote 0
By the way, may i have any other alternative formula to replace sumproduct. Because sumproduct is lacking my file really much. i got 10k rows with 10 columns full of sumproduct :T_T:

Thank you
 
Upvote 0
I know why it does not work. Due to F:F. if F1:F10, it works. But why?
And how to change H1 to 41 and still keep the formula work?

Thank you
 
Last edited:
Upvote 0
A SUMIFS would be more efficient than SUMPRODUCT in this case. Try:


Excel 2012
ABCDEFGHI
1NumACDrCrCodeNum4200142999
2111002100T1200
3111001100N2200
4142001200T3200
514200120N
6
7211002100T
8211001100N
9242002200T
1024200220N
11
12311003100T
13311005100N
14342005200T
1534200520N
Sheet2
Cell Formulas
RangeFormula
H2=SUMIFS(C:C,A:A,G2,E:E,"T",B:B,">="&$H$1,B:B,"<="&$I$1)+SUMIFS(D:D,A:A,G2,E:E,"T",B:B,">="&$H$1,B:B,"<="&$I$1)


Note that I used a >= and a <= condition for column B. If the values in that column are numbers, then you need numeric conditions. If they are numbers saved as text, then you could use something like "42*".

Also note that I used whole column references in the formula. You should NOT use whole column references in array formulas such as SUMPRODUCT, but in some Excel functions, such as MAX, SUM, SUMIFS, etc. Excel is aware of the used range and uses it when calculating it. Be aware of what type of function you're using before using whole column references.
 
Upvote 0
Good morning. It works. Thank you.
May I check one more issue please?
This mark * not working. Or I should use this mark instead? !?*
 
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,447
Members
448,966
Latest member
DannyC96

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