My current code is:

(SUM(INDIRECT(ADDRESS(ROW()-(I4:I- 1);COLUMN()-4;4)&":"&ADDRESS(ROW();COLUMN()-4;4)))*( ( J4:J ) / 10 ))))

I want to sum cells from GxGy but range is determed by cell I4. My existing code works, but only for one line.

=ArrayFormula( if( J4:J = "" ; "" ;

So if I put ArrayFormula in front, the calculation is shown only where the data is, but the result is always equal to the result of first row.

Can anyone help me?

You can view my sheet here.

1 Answer 1


With the magic of matrix multiplication and this solution (credit where credit is due), I have managed to wrangle it to do what you want.

=ArrayFormula(IF( J4:J = "" ; "" ; MMULT((ROW(G4:G)>=TRANSPOSE(ROW(G3:G)))*((ROW(G4:G)+1-I4:I)<=TRANSPOSE(ROW(G3:G)));G3:G)* ( ( J4:J ) / 10 ) ))

My head hurts already, so I won't go into too much explanatory detail, except to say that the key magic happens in


And I've added a second sheet to your public one with a rough equation builder, for understanding or alternative applications.

  • 1
    You're welcome. And I'll make you deliver on that offer one day. Oct 8, 2013 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.