Sum of a range that varies

S

Sebastien

Good day,

I am making the sum of a range that varies in length. For example

Cell(1, B) = SUM(A1:A10)

The cells A1 to A10 are a database that is updated daily, and the number of
rows varies also daily. So one day, the sum could be A1:A7, and the next day
it is A1:A12. Also, the range sometimes needs to start at A1, sometimes A3
or A5, it is never the same.

I would need a way to have the last value of my range as a variable instead
of a fix value.

The final formula should ideally fit in only one cell. I am thinking of
using the count() or the Row() function within my SUM formula but nothing
works.
 
R

Roger Govier

Hi Sebastien

Since you have a changing start and changing end to your range, you would
need a method of telling the formula where both of these values are.
With your formula in B1, set the start row in C1 and the end row in D1
=SUM(INDEX(A:A,C1):INDEX(A:A,D1))

With 5 in C1 and 17 in D1 it would be the same as
=SUM(A5:A17)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top