Variables

Copper Contributor

Trying to find a solution to Sum(x1:xa) where a is a variable number 1-12

 

5 Replies

@soffi1363 

Depends on concrete case, as variant

=SUM(X1:INDEX(X:X,a))
Hi Sergei
Thank you for answer. Could not make this work. Maybe Ithis would clarify my problem better. I am trying to sum a column a1 to aX where my X could be a2, a3... i.e.X is 2,3,4.... i.e. a variable. Nested funtions would be to cumbersome to use. Searcing for a better solution.

@soffi1363 

An alternative:

Let's say you enter a value in cell D1

=SUM(INDIRECT("A1:A"&D1))

 

(I don't think it's possible to do what you want without nesting a function within SUM)

Hi Hans

I am afraid you are right

@soffi1363 

Another variant of @Hans Vogelaar formula

=SUM(A1:INDEX(A:A,D1) )