Hi Peter,
I don't have access to some of these functions and therefore it doesn't work. However, in this particular case, the SUMPRODUCT solution is simpler and therefore easily maintainable or am I missing something here (apart from these latest functions :D )?
Simpler, or just more familiar?
If you look at the
SUMPRODUCT solution, the question is why
SUMPRODUCT and not
SUM? Where is the function performing a product? Both formulations create a 2D mask from two 1D Boolean arrays. The mechanism for removing unwanted values is slightly different, the
IF resulting in
FALSE rather than
0 for eliminated terms. If you are seeking
SUMIFS functionality either is fine, if you are interested in
COUNTIFS the first is better, though the latter can be reformulated. The answer that
SUMPRODUCT is there as a wrapper to perform array calculations rather than implicit intersection based calculation is itself far from simple.
A major plus of the modern methods is that the function
SUMIFSλ follows the same syntax as
SUMIFS and, once written, can be used elsewhere in the workbook without reimplementation, thus simplifying ongoing development. The entire solution is delivered as one dynamic range, so reducing the points of potential error (
e.g. incorrectly placed '$' making the basic formula copy/paste incorrectly (a common cause of error within traditionally developed workbooks).
The final step of introducing an
AGGREGATE IFS function and passing the Lambda functions to it as parameters, rather than using 'magic' numbers is just showing off; probably a solution without a use case to justify it!
There are some simplifications of the new methods. I have been able to abandon
A1 and
R1C1 notations and commit to defined names. I have little need for the complexities of relative referencing versus absolute, I can focus on the array rather than the cell and need not concern myself with array size; I do not make the decision of how far to copy/fill the formulae (in most cases it is clear but there have been some monumental errors caused by missing terms from a formula).
For me, simplicity is achieved by structuring solutions appropriately; basic methods applied in excessive volume is a recipe for complexity.
I owe you an apology for answering at far too great a length, but I felt I at least owe you some explanation for disrupting the forum!