Sumif using Vlookup to compare a separate list

P

petrons

Would anyone have an idea of how to sum values based on a lookup.

eg.

- List 1 -
Col A Col B
b 2
d 4
e 1
x 3
y 2


List 2
a
b
c
d
e

What I need to do is add selected List 1 Col B values where List 1 Col
A values appear in List 2. So the result above would be 7.

Is there some array formula so I don't have to do a lengthy nested
SUMIF for approx 30 values it needs to look for in List 2.

I know I could insert another column with a VLOOKUP to return
something and then SUMIF on that return value, but it's for an
existing large spreadsheet and I 'd rather do it in a single formula
if possible.

Many thanks

Peter
 
T

T. Valko

Try this:

=SUMPRODUCT(--(ISNUMBER(MATCH(A1:A5,E1:E5,0))),B1:B5)

Where E1:E5 = list2
 
C

carlo

Would anyone have an idea of how to sum values based on a lookup.

eg.

- List 1 -
Col A Col B
b 2
d 4
e 1
x 3
y 2

List 2
a
b
c
d
e

What I need to do is add selected List 1 Col B values where List 1 Col
A values appear in List 2. So the result above would be 7.

Is there some array formula so I don't have to do a lengthy nested
SUMIF for approx 30 values it needs to look for in List 2.

I know I could insert another column with a VLOOKUP to return
something and then SUMIF on that return value, but it's for an
existing large spreadsheet and I 'd rather do it in a single formula
if possible.

Many thanks

Peter

I'm not that good at array-formulas but it should work:

=SUM((A1=$D$1:$D$19)*$E$1:$E$19)

where A1 is your List2 lookupfield
D1:D19 are your List1 lookupfields
E1:E19 are your List1 Valuefields

enter it with ctrl+shift+enter, excel will then add {} by itself to
the formula

Then you can copy it down

hth

Carlo
 
P

petrons

Try this:

=SUMPRODUCT(--(ISNUMBER(MATCH(A1:A5,E1:E5,0))),B1:B5)

Where E1:E5 = list2

--
Biff
Microsoft Excel MVP












- Show quoted text -

Brilliant. That does the trick. Thanks Biff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top