View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.misc
David Biddulph[_2_] David Biddulph[_2_] is offline
external usenet poster
 
Posts: 8,651
Default sumproduct or countif

You don't need the double unary minus if you've got the addition. The
arithmetic operation is enough to coerce the conversion from boolean to
number. Double unary minus (or double unary negation if you prefer) is just
a way of forcing an arithmetic operation where you don't already have one.
You'll see that if you use the SUMPRODUCT((condition1)*(condition2)) format
you don't need the double unary minus, but with
SUMPRODUCT(--(condition1),--(condition2)) [comma instead of multiply] you do
need it.
--
David Biddulph


"JMay" wrote in message
...
=SUMPRODUCT(--(A1:A10="a")+--(A1:A10="b"),B1:B10)

change column letters row numbers according to your set up..

"freebee" wrote:

Hi, I need to sum numbers in one column based on 2 critarias from another
column, I have formula as
=SUMPRODUCT(--($O$20:$O$79="a"),--($O$20:$O$79="b"),$Q$20:$Q$79)
but the result showed 0.
Am I correct for using sumproduct or shall I use countif (which I haven't
learned yet)?
Thank you.