I would be grateful if anyone knows whether the following issue is documented and/or what the underlying reasons are.
Assuming we have, for example, the numbers from 1 to 10 in A1:A10, the following formula
=SUMPRODUCT(SUBTOTAL(4,OFFSET(A1,{0;5},0,5)))
is perfectly valid and is equivalent to taking the sum of the maximum values from each of the ranges A1:A5 and A6:A10, since the OFFSET function, here being passed an array of values ({0;5}) as its rows parameter and with the appropriate height parameter (5), resolves to the array of ranges:
{A1:A5,A6:A10}
which is then passed to SUBTOTAL to generate a further array comprising the maximum values from each of those ranges, i.e. 5 and 10, before being summed by SUMPRODUCT.
AGGREGATE was introduced in Excel 2010 as, it would seem, a more refined version of SUBTOTAL. My question is why, when attempting the following
=SUMPRODUCT(AGGREGATE(14,,OFFSET(A1,{0;5},0,5),1))
which should be equivalent to the SUBTOTAL example given above, does Excel display the message that it "Ran Out of Resources While Attempting to Calculate One or More Formulas" (and return a value of 0)?
(Note that users of a non-English-language version of Excel may require a different separator within the array constant {0;5}.)
This is a quite unexpected error. Evidently the syntax is not at fault, nor is the passing of the OFFSET construction 'disallowed'. With nothing else in the workbook, what is causing Excel to use so much resource when attempting to resolve such a construction?
A similar result occurs with INDIRECT instead of OFFSET, i.e.
=SUMPRODUCT(SUBTOTAL(4,INDIRECT({"A1:A5","A6:A10"})))
is perfectly valid, yet
=SUMPRODUCT(AGGREGATE(14,,INDIRECT({"A1:A5","A6:A10"}),1))
gives the same error described above.
Regards
=SUMPRODUCT(AGGREGATE(14,6,CHOOSE({1,2},A1:A5,G1:G5),1))will always return the max between the both ranges, with or without the sumproduct. The aggregate, unlike the Subtotal, iterates inside itself and returns only one answer to the SUMPRODUCT.CHOOSE(in which the two ranges are first resolved to a single array ofvaluesprior to being passed to the outlying function) andOFFSETandINDIRECT, which can be used to generate an array ofrangesto pass to functions such asSUBTOTALandCOUNTIF. And can you clarify what you mean by "The aggregate, unlike the Subtotal, iterates inside itself"? Is there some supporting documentation for this technical explanation? And why does this only apply to therangeparameter?I think.... I was just spit balling, which is why it is a comment and not an answer. Sorry, could not be more help. There are very few people on this board that understand the workings of formulas better than you. I will be following this thread, and hope someone who understands the inner working of AGGREGATE answers.