Sum of sums

This will work fine when the number of rows will be static. In my use case, neither number of rows nor number of columns will be fixed. I can only provide the the arrays I’ve provided in my fiddle.

There is one more issue in your fiddle: when you filter data, the cells which have SUM formula enabled get hidden automatically. And it is not a desired feature.