Below is a proposed solution for the challenge – Challenge 2 – Sum of Numbers in the Diagonal of a Square
Put following formula for the answer –
=IF(L2="B",SUMPRODUCT((OFFSET(H8,0,0,-MIN(8,L1),-MIN(8,L1)))*(ROW(OFFSET(H8,0,0,-MIN(8,L1),-MIN(8,L1)))=COLUMN(OFFSET(H8,0,0,-MIN(8,L1),-MIN(8,L1))))),SUMPRODUCT((OFFSET(A1,0,0,MIN(8,L1),MIN(8,L1)))*(ROW(OFFSET(A1,0,0,MIN(8,L1),MIN(8,L1)))=COLUMN(OFFSET(A1,0,0,MIN(8,L1),MIN(8,L1))))))
The worksheet for the solution can be downloaded from Solution – Challenge 2 – Sum of Numbers in the Diagonal of a Square