Array advance sum formula

G

Guest

=Sum(((Range1=value1/cell1)+(Range1=value2/cell2))*(Range2)
The above formula works fine it will sum Range2 where values in Range1 are
matching with cell1/value1 OR cell2/value.
My question is what if i have to compare values in Range1 with 10 or more
cells/values. currently it works by repeating the conditions say 10 times,
but this will make formula much bigger. Is there any way Range1 can be
compared with cell1, cell2,...cell10 at the same time.
 
L

Lori

Try using an array constant if it is a list of values:

=Sumproduct((Range1={value1,value2,...})*Range2)

Sumproduct has the advantage that it does not need to be array-
entered.

For cell references, instead of the array you can use a range such as
A1:E1 or transpose(a1:a5) for a vertical range or
Choose({1,2,3},b2,c5,e7) for a discontinuous range.
 
B

Bob Phillips

=SUM((ISNUMBER(MATCH(Range1,cell1:celln,0)))*Range2)

and

=SUM((ISNUMBER(MATCH(Range1,{"value1","value2"},0)))*Range2)

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

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