Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default using a variable in the sum function

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 222
Default using a variable in the sum function

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)
--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.


"abdul" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default using a variable in the sum function

On Feb 7, 6:30*pm, abdul wrote:
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?
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,480
Default using a variable in the sum function

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
--
Regards
Roger Govier

"abdul" wrote in message
...
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to run a function from a variable Gussie Excel Programming 4 October 30th 08 12:26 PM
Variable function ESP Tom Excel Discussion (Misc queries) 1 July 10th 06 09:37 PM
Variable function ESP Tom Excel Discussion (Misc queries) 2 July 10th 06 04:01 PM
Variable function ESP Tom Excel Discussion (Misc queries) 0 July 10th 06 02:15 PM
Using variable in a function alvin Kuiper Excel Programming 0 February 8th 06 09:43 PM


All times are GMT +1. The time now is 04:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"