View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Herbert Seidenberg
 
Posts: n/a
Default Sum function that add every 13th row...

Here is a non-VBA solution, using functions.
Assume your data looks like this:
lista
1
2
3
4
....
299
300

i_val
13
st_row
18
end_row
226

listb
18
31
44
57
70
....
213
226

lista contains your input data, in this case numbers from 1 to 300.
i_val is the interval (every 13th number)
st_row is your starting row in lista (the 18th entry in lista)
end_row is your ending row in lista (lista can be longer than that)
listb is the output.
Give all the lists and constants the names indicated.
Use Insert Name Define
Also define these names:
no_rows Refers To =INT((end_row-st_row)/i_val+1)
seq Refers To
=(ROW(INDEX($A:$A,1):INDEX($A:$A,no_rows))-1)*i_val+st_row
Select the cells under listb and enter this array formula
(Ctrl+Shift+Enter)
=INDEX(lista,seq)
listb is no_rows deep.
The final answer is
=SUM(listb)