Pls help me !

D

davidiew

Greeting!

I fail to get an answer when I try to sum up (amount) based on 2 othe
varibles (Type & Sales).
I need to have 3 answers at cell F17, F18 and F19.
What fomula should I put into these cell?

Pls check on file (01) attached.
Can you help me?
Thank

Attachment filename: sales123.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=45546
 
J

JulieD

Hi David

you need to use the sumproduct function

formula for F17
=SUMPRODUCT(($D$6:$D$14="Toyota")*($E$6:$E$14="New")*$F$6:$F$14)
cooy and adjust for other cells

cheers
JulieD
 
G

gilbert

Hi JulieD,

Sorry, I don't mean to be rude....just wanted to clarify...

Why is the formula require "*" instead of ","? when I type the functio
in Excel, it appears to be sumproduct(array1,[array2],[array3],....

What is the rationale behind using "*"? Would appreciate you
explaination.

Thanks.

Rgds,
Gilber
 
J

JulieD

Hi Gilbert

I'm trying to find a fantastic article written by Aladin Akyurek on the
SUMPRODUCT function for you ... but can't find the link (maybe someone else
here has a link to this article?)

However, my limited understanding of it goes like this:

In its basic form the SUMPRODUCT function multiplies number arrays and then
adds the result of each multiplication and returns the answer. Hence the
sumproduct(array1,[array2],[array3],....) structure

BUT

it can also be used as a multi-conditional counting or summing function
using the * operant, which in this case functions as a boolean AND.
Basically we ask excel to evaluate each cell to a True or False state
(whether it matches the criteria or not), and then multiply the result of
that cell with other cells to get a true or false outcome over multiple
cells and then sum or count the results

here's an example

A B C
1 cat blue 10
2 cat green 5
3 dog blue 3
4. cat blue 3

if you wanted the sum of column C where A = cat AND B=blue then

=SUMPRODUCT((A1:A4="cat")*(B1:B4="blue")*C1:C4)

excel evaluates true to 1 and false to 0 (in the example below i use T for
True & F for False)

so it would work through a process like this
=SUMPRODUCT((A1:A4="cat")*(B1:B4="blue")*C1:C4)
=SUMPRODUCT(({cat,cat,dog,cat}="cat")*({blue,green,blue,blue}="blue"))*{10,5
,3,3}) 'check each cell against criteria
=SUMPRODUCT(({T, T, F, T})*({T, F, T,T}))*{10,5,3,3}) 'return T for true /
F for false
=SUMPRODUCT(({1,1,0,1})*({1,0,1,1}))*{10,5,3,3}) 'evaluate T = 1 & F = 0
=SUMPRODUCT(({1*1,1*0,0*1,1*1})*{10,5,3,3}) 'multiply the two columns
together
=SUMPRODUCT(({1,0,0,1})*{10,5,3,3}) 'A1 & B1 meet the condition as does A4 &
B4
=SUMPRODUCT(1*10+0*5+0*3+1*3) 'multiply this with the cells to add
=SUMPRODUCT(10+0+0+3) 'add the cells that meet the condition
=13

Hope this helps - someone else might be able to supply a clearer
explaination for you.

Cheers
julieD
 
G

gilbert

Hi JulieD,


Wow, what an in depth explanation. Thanks a zillion, you have provid
me a very clear explanation. I just wonder if you are a teacher......

:)

Thank you once again.

Rgds,
Gilber
 
J

JE McGimpsey

That's mostly correct.

You can also use the comma form of SUMPRODUCT, which, in tests I've run
on my machine, is faster than using *.

However, SUMPRODUCT requires numeric arrays, so if you're using a
conditional array (returing boolean TRUE/FALSE), the array needs to be
explicitly coerced to numeric. That happens automatically when the *
operator is used. I prefer to use the unary minus operator, which is
more tightly bound and very fast, so

=SUMPRODUCT((A1:A100="A")*(B1:B100=B)*C1:C100)

can be written

=SUMPRODUCT(--(A1:A100="A"),--(B1:B100=B),C1:C100)

Again, on tests I've run using MacXL, the second form is about 5% faster
than the first, which I attribute to optimizations in SUMPRODUCT, since
in the first form, the array multiplication happens before the data is
passed to SUMPRODUCT, while in the second form, the array multiplication
is handled by the SUMPRODUCT routine. However, YMMV.
 

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