I know how to use BYROW()
, CHOOSECOLS()
and LAMBDA()
etc. to sum up columns.
e.g.
=BYROW(CHOOSECOLS(B2:M3,1,2,3,4,5,6),LAMBDA(a,SUM(a)))
I would like to sum up columns but the columns to be summed up would be different in each row depending on a a cell in that row
e.g. in row 1, I want to sum up columns 1,2,3,4 but in row 2 I want to sum up 5,6,7,8,9,10,11 and 12
I was thinking something along the lines of:
=BYROW(b2:m3,LAMBDA(a,SUM(CHOOSECOLS(a,TEXTSPLIT(A2,",")))))
where A2
would have 1,2,3,4 and A3
would have 5,6,7,8,9,10,11,12
However this does not work
Is this possible?
Pretty simple use the whole range in BYROW()
function, TAKE()
the first column while for sum DROP()
the first col:
=BYROW(A2:M3,LAMBDA(α,SUM(CHOOSECOLS(DROP(α,,1),--TEXTSPLIT(TAKE(α,,1),",")))))