Search code examples
google-sheets-formula

Sum cells from array knowing a start location and number of cells


I have an array of cells, they run left to right, top to bottom. I'm trying to write a formula that can sum a section of the cells. I need to provide how many cells to skip, then how many to sum after this point. I know how I could do this if they were all in a column, but needing to go left to right and wrap back after 15 cells is new to me.

So for example, skip 61, sum 5, would end up suming A2, A3, A4, A5, A6 and give a total of 94.

Example array of values


Solution

  • You may try:

    =let(skip_, 61, sum_, 5,
         sum(chooserows(tocol(A2:O),sequence(sum_,1,skip_+1))))