using a variable in the sum function

A

abdul

I am trying to sum a column with the sum function say : sum(a1:a12)
however I don't always want it to add row 1 to row 12

depending on an inputted number I want to add a3 to a12, or a5 to a12, or
somthing like that
is there a way I can make the sum function do that or is there any other way
to sum up a column from row x to row 12 or something like that
 
J

JBeaucaire

You could use an INDIRECT formula to insert a number you've placed in a cell
somewhere to affect the sum range. For instance, if you put the number 4 into
cell C1, then this formula:

=SUM(INDIRECT("A"&C1&":A12"))

....would equate to =SUM($A$4:$A$12)
 
C

Canlink

I am trying to sum a column with the sum function say : sum(a1:a12)
however I don't always want it to add row 1 to row 12

depending on an inputted number I want to add a3 to a12,  or a5 to a12, or
somthing like that
is there a way I can make the sum function do that or is there any other way
to sum up a column from row x to row 12 or something like that

Do you mean that if any of the cells in a specified range contain a
specific number then that number should be added to the summation? Am
I complicating your question? Or do you mean that part of your
summation refers to a user inputted cell?
 
R

Roger Govier

Hi Abdul

Try
=SUM(INDEX(A:A,C1):INDEX(A:A,C2))
with your starting row number in C1 and you ending row number in C2
 

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