I decided to learn how to work with the function SumProduct()
, so I created this very basic Excel sheet:
A B
1 1
2 2
I calculated =SumProduct(A2:A3,B2:B3)
and the result was 5, which was as expected.
Then I got the idea to replace B2 by =(1=1)
, which obviously is TRUE
, which is confirmed by what I see.
However, the =SumProduct()
result changed into 4, apparently booleans
are treated as zero in Excel.
So, I decided to write another formula: =A2*B2+A3*B3
(which is exactly the same as the SumProduct()
), but instead of getting the expected value 4, the value remained 5.
So, apparently, regular mathematical operators (*
, +
, ...) treat boolean
values as "to be expected" (TRUE
becomes 1 and FALSE
becomes 0), but for some more elaborated functions (like SumProduct()
) this seems not to be the case.
What's the explanation behind this? I would like to understand what's happening in order to avoid unpleasant surprises. I think I'm working with Excel-365 (how can I be sure?).