I have the following data:

The orange highlighted rows are summary rows of all of the data above it.

The yellow highlighted fields are sum fields (plus a unique formula relevant to my use case). Essentially the yellow highlighted fields are sums of all the data in rows above it up until the next 'Summary' column.

For example K5 is calculated by summing 131.12 + 106.624 + 16.7621...

What I would like is that as I go down the worksheet, a formula which sums the highlighted yellow scores of those scores with the same 'code', where the code field is column C.

For example I would like L5 to identify that B5 is a Summary field, identify the code from C5, and therefore be equal to K5 (because this is the top of the workbook).

Now as I move down, L8 should be equal to K5 + K8. As row 8 has the same 'code' as row 5.

L14 = K5 + K8 + K14

L16 = K16 (different code in column C)

L25 = K25 + K16

L31 = K31 + K25 + K16

So essentially, a formula that reads from top to bottom of a worksheet, identifies 'Summary' rows AND identifies the 'code'. Grabs the summary score of that row (if the code is the same), and then adds it going down the worksheet.

So L5 should equal 254.50....

L8 should equal 254.50 + 26.45

etc.

Any help would be awesome.

Thanks!