View Single Post
  #14   Report Post  
Posted to microsoft.public.excel.worksheet.functions
joeu2004 joeu2004 is offline
external usenet poster
 
Posts: 2,059
Default Formula for sum of alternate cells

On Mar 23, 4:25*am, Vibhor Bansal wrote:
This formula help me also for sum of the products at
alternate columns. I just wanna know the impact of '--'
in a formula for better understanding.


Presumably you are asking about a formula like:

=SUMPRODUCT(--(MOD(COLUMN(D23:KK23),2)=0),D23:KK23)

The double-negative (--) converts TRUE and FALSE to 1 and 0, which
SUMPRODUCT requires to be effective in this context.

Any arithmetic operation would do the same thing. For that reason,
some people prefer to multiply by 1 (1*) instead of using double-
negative.

Also, for example:

=SUMPRODUCT((A1:1003)*(A1:A100<=7))

counts the number of cells in A1:A100 that meets both conditions. The
multiply (*) acts like AND; we cannot use AND in this context.

No need for double-negative (--) in that context, although the
following is equivalent:

=SUMPRODUCT(--(A1:1003),--(A1:A100<=7))

Basically, use double-negative when there is no other arithmetic
operations that would convert TRUE and FALSE to 1 and 0.