I am trying to use the same formula repeatedly in a range. Doing it with VBA is easy, but I am trying to do it without using VBA and all in one formula. I am trying to use SEQUENCE
and OFFSET
but am always getting a spill alert. What am I doing wrong here? The goal is to multiply the value in the first column with a fixed variable dependent on what is chosen in the last column, i.e. CAT2 or 3 and then sum it all up WITHOUT any intermediate columns.
=SUM(LAMBDA(Nh;Cu;Nh*Cu)(OFFSET(CHOOSE(MATCH(OFFSET(K$18;z;0);$F$7:$H$7;0);$F$9;$G$9;$H$9);V43;0);OFFSET(E$18;z;0)))
z=SEQUENCE(ROWS(B18:B34);1;E18;1)
This is a spillable version of your SUMPRODUCT()
=LET(dat,B1:F17,lkp,K3:M6,MAKEARRAY(ROWS(lkp),COLUMNS(dat),LAMBDA(r,c,SUMPRODUCT(INDEX(dat,,c),INDEX(lkp,r,MATCH(H1:H17,K1:M1))))))