Thread: sumif
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
hjc hjc is offline
external usenet poster
 
Posts: 17
Default sumif


Hi, Petros

I think Gary''s response is definitely better than mine for what you are
trying to do. Who knew that you could multiply truth values??

On the other hand, my solution can be used in place of COUNTIF as
well...just substitute a 1 for the range C10:C20. The rest of the equation
remains unchanged (i.e., you still use SUM, not COUNT.)

In any case, I hope you got what you need!

Regards,
Hugh John



"Gary''s Student" wrote:

Consider SUMPRODUCT instead:

Here is some data:

1 happy
2 happy
3 happy
4 happy
5 happy
6 happy
7 happy
8 happy
9 happy
10 happy
11 happy
12 happy
13 happy
14 happy
15 sad
16 sad
17 sad
18 sad
19 sad
20 sad

and we want the sum of column A if:
1. the value in A is greater than 10
2. the value in column B is happy

=SUMPRODUCT((A1:A2010)*(B1:B20="happy"),A1:A20)
which will return 50


For a really good discussion, see:

http://www.cpearson.com/newsletter/c...2007_08_13.htm


--
Gary''s Student - gsnu200774


"Petros" wrote:

Hi!
I would liek to use sumif but use criteria from 2 columns instead of one. i
tried to use the conditional sum wizard in the add-ins but when I change
something it does not seem to work. Any ideas?
Thank you
Petros