Forum Discussion
Charley Kyd
Apr 04, 2022Copper Contributor
SUBTOTAL, OFFSET, and bogus results
In this formula... =OFFSET(Values,0,0,SEQUENCE(10)) ...Values is a column of ten numbers. And the formula returns ten #VALUE! errors, presumably because Excel can't (yet?) manage an array of arrays...
JMB17
May 17, 2022Bronze Contributor
I happened across this blog and it reminded me of this post, as you mentioned excel being able to handle an "array of arrays". So, I thought I would leave it here in case you've not yet come across it.
https://www.flexyourdata.com/blog/what-is-a-thunk-in-an-excel-lambda-function/
So, it would appear an array of subtotals can be done:
- SergeiBaklanMay 18, 2022Diamond Contributor
With VSTACK it's bit easier
=IFNA( DROP( REDUCE(0, SEQUENCE( ROWS(values)), LAMBDA(a,v, VSTACK(a, TRANSPOSE(SCAN(, INDEX(values, SEQUENCE(v) ), LAMBDA(a,v,a+v) ) ) ) ) ), 1 ), "")
Not sure why simple REDUCE repeats accumulator in first row
=IFNA( REDUCE(0, SEQUENCE( ROWS(values)), LAMBDA(a,v, IF( v = SEQUENCE(v), TRANSPOSE(SCAN(, INDEX(values, SEQUENCE(v) ), LAMBDA(a,v,a+v) ) ), a ) ) ), "")
lori_m , perhaps you may explain