Conditional Sum Product

B

Ben010

I want to get the sumproduct of two rows of numbers based on an IF condition
in a related row. The formula would look like this:
=Sumproduct(a2:z2, a3:z3)* Multiplier if a1:z1="Yes", otherwise Multiplier =1
So if a1="Yes" then the product would be a2*a3*M; if b1<>"Yes" then the
product would be b2*b3*1. Any ideas?
 
B

Bob Phillips

=SUMPRODUCT(--(A1:Z1="Yes"),A2:Z2,A3:Z3)

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)
 
H

hansjhamm

Bob,

I was reading thru some of the posts and saw your response...I have a
question. I use sumproduct alot, but I do not/have not used the (--
What does this do exactly?

Thanks,

Hans
 
B

Ben010

Bob--
Thanks. My original query was probably not clear. If A1:Z1 is "Yes" then I
want the cell to compute to your answer times a multiplier. If "No" I want
the cell to compute to exactly your answer (multiplier =1).

Ben
 
B

Bob Phillips

What multiplier?

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)
 
B

Ben010

Let me show you the first part of my array:
A B C D X Y
1 Yes No Yes Yes 1.5 1
2 6 3 2 2
3 2 4 6 3

A1:D3 is my array. X and Y are the multipliers. The calculation for this
would be :
6*2*1.5+ 3*4*1+ 2*6*1.5+ 2*3*1.5. Thus, if A1:D1 is "Yes" then the
corresponding product multiplies by 1.5. If A1:D1 is "No" then it multiplies
by 1.
 
B

Bob Phillips

=SUMPRODUCT((ISNUMBER(SEARCH({"Yes";"No"},A1:Z1)))*({1.5;1})*(A2:Z2)*(A3:Z3)
)

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)
 
B

Ben010

Bob--
Thanks. I appreciate the help.

Bob Phillips said:
=SUMPRODUCT((ISNUMBER(SEARCH({"Yes";"No"},A1:Z1)))*({1.5;1})*(A2:Z2)*(A3:Z3)
)

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)
 
B

Ben010

Bob--
How can I make the {1.5;1} numbers variables? That is I want to reference a
cell rather than make them numbers, such as {v1;v2}

Ben
 
B

Bob Phillips

Yeah, if contiguous

=SUMPRODUCT((ISNUMBER(SEARCH({"Yes";"No"},A1:Z1)))*(V1:V2)*(A2:Z2)*(A3:Z3))

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)
 
B

Ben010

Nice. Thanks!

Bob Phillips said:
Yeah, if contiguous

=SUMPRODUCT((ISNUMBER(SEARCH({"Yes";"No"},A1:Z1)))*(V1:V2)*(A2:Z2)*(A3:Z3))

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)
 

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