Forum Discussion
FredAlves
Aug 28, 2026Tin Contributor
When #VALUE! isn’t an error: The hidden reference behavior of Excel’s dynamic arrays
1. Mechanism Overview Functions such as TAKE, DROP, OFFSET, and INDIRECT normally produce a range when supplied with scalar parameters. When instead a 1-D or 2-D numeric array is passed to one of th...
djclements
Aug 29, 2026Silver Contributor
Great stuff! Very interesting... thank you for laying it out in complete detail.
Under 2.2 Deferred Evaluation, you've hinted towards "aggregation functions that re-evaluate their inputs individually". So far, I've found the xxIF(S) family functions can handle an "array of ranges", as well as SUBTOTAL (but not AGGREGATE). Are you aware of any others?
Examples:
// Running count by category
= LET(
cat, TOROW(UNIQUE(SORT(Category))),
VSTACK(cat, COUNTIFS(TAKE(Category, SEQUENCE(ROWS(Category))), cat))
)
// Running total by category
= LET(
cat, TOROW(UNIQUE(SORT(Category))),
VSTACK(cat, SUMIF(TAKE(Category, SEQUENCE(ROWS(Category))), cat, Amount))
)
// Running total by row and column
= SUBTOTAL(9, TAKE(range_2d, SEQUENCE(ROWS(range_2d)), SEQUENCE(, COLUMNS(range_2d))))
// Running total by row and column, last to first
= SUBTOTAL(9, TAKE(range_2d, SEQUENCE(ROWS(range_2d),, ROWS(range_2d), -1), SEQUENCE(, COLUMNS(range_2d), COLUMNS(range_2d), -1)))
// Running total by row --> equivalent to: = SCAN(, BYROW(range_2d, SUM), SUM)
= SUBTOTAL(9, TAKE(range_2d, SEQUENCE(ROWS(range_2d))))
// Running total by column --> equivalent to: = SCAN(, BYCOL(range_2d, SUM), SUM)
= SUBTOTAL(9, TAKE(range_2d,, SEQUENCE(, COLUMNS(range_2d))))
// Running total by n x n block
= SUBTOTAL(9, TAKE(range_2d, {1;2;3;4}, {1;2;3;4})) // vertical output
= SUBTOTAL(9, TAKE(range_2d, {1,2,3,4}, {1,2,3,4})) // horizontal output
// Running total for a targeted section
= SUBTOTAL(9, TAKE(DROP(range_2d, 1, 1), {1;2;3}, {1,2}))FredAlves
Sep 01, 2026Tin Contributor
I had already tried this with IF functions, but I didn't realize it also worked with SUBTOTAL. That's interesting!
You can also use an array of ranges as XLOOKUP's return array, which allows it to return the entire array rather than just a single value, as in this example:
=XLOOKUP(5, SEQUENCE(10), TAKE(A1:J10, SEQUENCE(10), SEQUENCE(10)))