Concerning the terms:
What the OQer tried is not a matrix multiplication. That’s a completely different thing done by MMULT()
.
What he (f/m) obviously is trying to achieve is an iterating array-evaluation
.
SUM()
and AND()
both are functions converting arrays placed on their parameter positions to sequences (lists). They are not eligible for array-evaluation therefore, and this is expressly specified.
Help texts never can mention all these details.
PLease note: The Boolean functions NOT()
and XOR()
are eligible for array-evaluation.
The given formula {=SUM((A1:A40>=C1)*(A1:A40<C2)*B1:B40)}
(the curly brackets being automatically added for the display only) can work as intended if entered for array-evaluation (by Ctrl+Shift+Enter
e.g.) because the one parameter expression of SUM() - that’s (A1:A40>=C1)*(A1:A40<C2)*B1:B40)
- is evaluated in array-mode then. This isn’t done by the SUM()
function itself, but in advance of passing the result to SUM
.
Using the AND() function there in place of the arithmetic surrogate of multiplying the Boolean results autoconverted to ordinary numbers, will spoil this because AND()
never will return an array. It always accumulates. Simply try it outside of the SUM() construct to clearly see what I mean.
If you insist on thorough distinction between Boolean and arithmetic results you are not directly supported by standard functions in the case. That’s simply a fact.
The simplest workarounds I can give are:
If((ArrayExpression1WithBooleanResults * ArrayExpression2WithBooleanResults)=1;TRUE();FALSE())
for AND and
If((ArrayExpression1WithBooleanResults + ArrayExpression2WithBooleanResults)>0;TRUE();FALSE())
for OR.
This way you also rely on the autoconversion Boolem ==>> Double, but you get the result in the same way as you get Boolean results otherwise.
My advice: Avoid the complication in this case. Soften strictness insofar as long as the functionality is clear.
In addition: The AND() functionality you also get using SUMPRODUCT()
. (Riduculous name!) and there is the advantage that you don’t need the Ctrl+Shift when entering because the parameters of SUMPRODUCT()
are specified ForceArray
anyway.The OR() functionality is not available in a similar way.