View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
joeu2004 joeu2004 is offline
external usenet poster
 
Posts: 2,059
Default What does -- mean in formulas

On Nov 29, 8:20 am, "Peo Sjoblom" wrote:
"joeu2004" wrote in message
The "--" could have been avoided by coding the formula as follows,
with the same effect:
=SUMPRODUCT((A1:A100=1)*(B1:B100<""))


But there is a difference, the former uses SUMPRODUCT's built in
way of dealing with the arrays thus if you for instance use

=SUMPRODUCT((A1:A100=1)*(B1:B100<"")*(C1:C100))
vs.
=SUMPRODUCT(--(A1:A100=1),--(B1:B100<""),C1:C100)

to SUM what's in C and if the values in C can contain text like "" derived
from formulas the former will throw an error


I should have written ``__in_this_case__ "--" could have been
avoided``. And perhaps you should have written "__sometimes__ there
is a difference".

I don't believe there is a difference in the OP's example. And I
would have written your counter-example correctly as:

=SUMPRODUCT((A1:A100=1)*(B1:B100<""),C1:C100)

Perhaps the counter-example you were struggling to think of is:

=SUMPRODUCT(--(A1:A100=1),C1:C100)

I agree that there are circumstances where it is incorrect to replace
that with:

=SUMPRODUCT((A1:A100=1)*C1:C100)