In G1 I put a 1 and then in G2 copied down I used this formula

=IF(F2=1,IF(MOD(COUNTIF(F$1:F1,1),8),LOOKUP(2,1/(F$1:F1=1),G$1:G1),MAX(G$1:G1)+1),G1+1)

that will count sequentially until it reaches another 1 in column F, then reset to 1 and then count and reset....doing that 8 times until it encounters another 1, then it resets to the next number (in this case 298) and then counts through again until the next 1 in F when it resets again to 298.....repeating 8 times again, then resetting to the next integer. That can go on indefinitely.

In Column H there is:

=SUMIF(G:G,ROWS(H$1:H1),B:B)

The ROWS function just returns 1 in row 1, 2 in row 2 etc. indefinitely so that allows the SUMIF to sum 8 B column values each time based on the formula in column G

## Bookmarks