SumProduct question
The condition (A1:A4="x") gives an array of TRUE and FALSE, but these
can't be used in arithmetic. The double unary minus, --, converts
these to an array of 1s and 0s, which can be, and each of these is
then multiplied by the array elements in B1:B4.
Incidentally, as you only have one condition then SUMIF would be a
better function to use:
=SUMIF(A1:A4,"x",B1:B4)
Hope this helps.
Pete
On Nov 14, 2:45*pm, wilson wrote:
Dear all,
* * * * * * A * * * * * *B
1 * * * * *Item * * * *Number
2 * * * * *x * * * * * *1
3 * * * * *y * * * * * *2
4 * * * * *x * * * * * *3
SumProduct(--(A1:A4="x"),(B1:B4)) gives the correct answer 4.
However, SumProduct((A1:A4="x"),(B1:B4)) gives the incorrect answer,
it incorrectly gives 0.
Any idea why?
Thanks,
Wing
|