Vlookup , more than one condition

kanelones

Board Regular
Joined
Aug 25, 2010
Messages
103
Hi!, maybe you can help me with this question.

I have for example this range of data:

A 1
B 2
C 3
D 4
E 5
F 6
G 7


Need to sum the data corresponding with certain letters on column A ( example data C+data F+data G, should give 16 as result) using vlookup function..

I mean, do i have a way instead of =VLOOKUP(A3,A1:B7,2,FALSE)+VLOOKUP(A6,A1:B7,2,FALSE)+VLOOKUP(A7,A1:B7,2,FALSE), to summarize all the conditions with within a simple line?

I appreciate you help as usual..

Pablo


 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
If your situation is exactly as described, you could also use something like SUMIF, together with a helper column which includes a flag on whether or not to include it in the SUMIF.

For example

A 1 N
B 2 N
C 3 Y
D 4 N
E 5 N
F 6 Y
G 7 Y

=SUMIF(C1:C7,"Y",B1:B7)
 
Upvote 0
You can also substitute a contiguous range for the array of constants.

If non contiguous:

=SUM(SUMIF($A$1:$A$7,CHOOSE({1;2;3},A3,A6,A7),$B$1:$B$7))

(ctrl-shift-enter is needed for both unless you type sumproduct instead of sum)
 
Upvote 0
You can also substitute a contiguous range for the array of constants.

If non contiguous:

=SUM(SUMIF($A$1:$A$7,CHOOSE({1;2;3},A3,A6,A7),$B$1:$B$7))

(ctrl-shift-enter is needed for both unless you type sumproduct instead of sum)

OK, but the data is in diferent columns to the right, not just the next column were the conditions are, sorry i didn't clarify it for you, that's why i need to use vlookup i think...

Tks again
 
Upvote 0
A
B
C
D
1
A
1​
criteria SUM
2
B
2​
C
3
C
3​
F
4
D
4​
G
5
E
5​
6
F
6​
16​
7
G
7​

<tbody>
</tbody>

D6=SUMPRODUCT(SUMIF($A$1:$A$7,$D$2:$D$4,$B$1:$B$7))
 
Upvote 0
Or you could even perhaps use SUMIFS instead of SUMIF.

But it's difficult to say for certain, without seeing an answer to sheetspread's question about "how do you know which columns ?"
 
Upvote 0

Forum statistics

Threads
1,215,659
Messages
6,126,074
Members
449,286
Latest member
Lantern

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