Sum #rows where # is the number of rows which shall be summarised

Hi,
I have random numbers in 100 rows; from A1:A100
In row B I have a value which indicate how many rows that shall be summarised.

E.x

# A - B (row)

1 2 - 2

2 4

3 3 - 4

4 5

5 1

6 2

So in B1 there is a 2 which means that I shall summarise A1:A2 (=6), and
in B3 there is a 4 which means that I shall summarise A3:A6 (=11)

I need to make a sum formula which does this automatically.
Does anyone know a way to do that…?

Hi

You can use something like =IF(B1<>"";SUM(OFFSET(A1;0;0;B1));"")

See SumRow.ods

Regards

Great! Thanks a lot!