Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 21
Default How to dynamically add up varying # of cells base on a value

How do I get a formula to decide on the # of cells to add up base on the
value in another cell.

For example, column A to L contains the $saving for each months of the
year from Jan to Dec. And say that savings for the first x months of the
year could be carried over from the previous year; and that x value is
reflected in column M. And I want to know the total $saving that is carried
over from the previous year. So, how do get the formula to add up the first
x number of months and put the value in column O.


Jan Saving Feb Saving Mar Saving Apr Saving May Saving Jun
Saving Jul Saving Aug Saving Sep Saving Oct Saving Nov Saving
Dec Saving # Months carried over Savings Carried Over
100 200 150 160 300 350 400 200 200 300 300 400 4 610
100 100 200 250 150 700 600 700 600 500 550 500 5 800
300 400 300 250 200 800 300 500 600 500 550 500 0 0





Thanks very much.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 793
Default How to dynamically add up varying # of cells base on a value

With 5 in B1 the following will sum the range A1:A5
=SUM(INDIRECT("A1:A"&B1))

if you change B1 to 10 it will sum the range A1:A10

"Felicia" wrote:

How do I get a formula to decide on the # of cells to add up base on the
value in another cell.

For example, column A to L contains the $saving for each months of the
year from Jan to Dec. And say that savings for the first x months of the
year could be carried over from the previous year; and that x value is
reflected in column M. And I want to know the total $saving that is carried
over from the previous year. So, how do get the formula to add up the first
x number of months and put the value in column O.


Jan Saving Feb Saving Mar Saving Apr Saving May Saving Jun
Saving Jul Saving Aug Saving Sep Saving Oct Saving Nov Saving
Dec Saving # Months carried over Savings Carried Over
100 200 150 160 300 350 400 200 200 300 300 400 4 610
100 100 200 250 150 700 600 700 600 500 550 500 5 800
300 400 300 250 200 800 300 500 600 500 550 500 0 0





Thanks very much.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default How to dynamically add up varying # of cells base on a value

Try this:

=SUM(A1:INDEX(A1:L1,n))

Where n = a number or a reference to a cell that holds the number.

A5 = 6

=SUM(A1:INDEX(A1:L1,A5))

That will sum A1:F1. If A5 is an empty cell the formula will calculate the
entire range.

--
Biff
Microsoft Excel MVP


"Felicia" wrote in message
...
How do I get a formula to decide on the # of cells to add up base on the
value in another cell.

For example, column A to L contains the $saving for each months of the
year from Jan to Dec. And say that savings for the first x months of the
year could be carried over from the previous year; and that x value is
reflected in column M. And I want to know the total $saving that is
carried
over from the previous year. So, how do get the formula to add up the
first
x number of months and put the value in column O.


Jan Saving Feb Saving Mar Saving Apr Saving May Saving Jun
Saving Jul Saving Aug Saving Sep Saving Oct Saving Nov Saving
Dec Saving # Months carried over Savings Carried Over
100 200 150 160 300 350 400 200 200 300 300 400 4 610
100 100 200 250 150 700 600 700 600 500 550 500 5 800
300 400 300 250 200 800 300 500 600 500 550 500 0 0





Thanks very much.



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 21
Default How to dynamically add up varying # of cells base on a value

Great, exactly what I needed. Thanks very much, Biff !

Felicia

"T. Valko" wrote:

Try this:

=SUM(A1:INDEX(A1:L1,n))

Where n = a number or a reference to a cell that holds the number.

A5 = 6

=SUM(A1:INDEX(A1:L1,A5))

That will sum A1:F1. If A5 is an empty cell the formula will calculate the
entire range.

--
Biff
Microsoft Excel MVP


"Felicia" wrote in message
...
How do I get a formula to decide on the # of cells to add up base on the
value in another cell.

For example, column A to L contains the $saving for each months of the
year from Jan to Dec. And say that savings for the first x months of the
year could be carried over from the previous year; and that x value is
reflected in column M. And I want to know the total $saving that is
carried
over from the previous year. So, how do get the formula to add up the
first
x number of months and put the value in column O.


Jan Saving Feb Saving Mar Saving Apr Saving May Saving Jun
Saving Jul Saving Aug Saving Sep Saving Oct Saving Nov Saving
Dec Saving # Months carried over Savings Carried Over
100 200 150 160 300 350 400 200 200 300 300 400 4 610
100 100 200 250 150 700 600 700 600 500 550 500 5 800
300 400 300 250 200 800 300 500 600 500 550 500 0 0





Thanks very much.




  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 21
Default How to dynamically add up varying # of cells base on a value

This works great, exactly what I needed. Thanks very much, Biff !

Felicia

"T. Valko" wrote:

Try this:

=SUM(A1:INDEX(A1:L1,n))

Where n = a number or a reference to a cell that holds the number.

A5 = 6

=SUM(A1:INDEX(A1:L1,A5))

That will sum A1:F1. If A5 is an empty cell the formula will calculate the
entire range.

--
Biff
Microsoft Excel MVP


"Felicia" wrote in message
...
How do I get a formula to decide on the # of cells to add up base on the
value in another cell.

For example, column A to L contains the $saving for each months of the
year from Jan to Dec. And say that savings for the first x months of the
year could be carried over from the previous year; and that x value is
reflected in column M. And I want to know the total $saving that is
carried
over from the previous year. So, how do get the formula to add up the
first
x number of months and put the value in column O.


Jan Saving Feb Saving Mar Saving Apr Saving May Saving Jun
Saving Jul Saving Aug Saving Sep Saving Oct Saving Nov Saving
Dec Saving # Months carried over Savings Carried Over
100 200 150 160 300 350 400 200 200 300 300 400 4 610
100 100 200 250 150 700 600 700 600 500 550 500 5 800
300 400 300 250 200 800 300 500 600 500 550 500 0 0





Thanks very much.






  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 21
Default How to dynamically add up varying # of cells base on a value

Hi, Sheeloo:

Thanks for the suggestion. Tried it out and if I understand this formula
correctly, it seems to sums up range of cells in the same column (ie A1:A5)
only. So, what if I needed to sum up range of cells in the same row (ex
A1:L1) ?

T. Valko also responded with the suggestion of using INDEX. Is that the
approach for suming up cross the row or is there still possible option by
using the INDIRECT function ? Just wanted to confirm. And eitherway, great
to learn about this INDIRECT function as well as I'm sure I'll find use for
it later.

Felicia

"Sheeloo" wrote:

With 5 in B1 the following will sum the range A1:A5
=SUM(INDIRECT("A1:A"&B1))

if you change B1 to 10 it will sum the range A1:A10

"Felicia" wrote:

How do I get a formula to decide on the # of cells to add up base on the
value in another cell.

For example, column A to L contains the $saving for each months of the
year from Jan to Dec. And say that savings for the first x months of the
year could be carried over from the previous year; and that x value is
reflected in column M. And I want to know the total $saving that is carried
over from the previous year. So, how do get the formula to add up the first
x number of months and put the value in column O.


Jan Saving Feb Saving Mar Saving Apr Saving May Saving Jun
Saving Jul Saving Aug Saving Sep Saving Oct Saving Nov Saving
Dec Saving # Months carried over Savings Carried Over
100 200 150 160 300 350 400 200 200 300 300 400 4 610
100 100 200 250 150 700 600 700 600 500 550 500 5 800
300 400 300 250 200 800 300 500 600 500 550 500 0 0





Thanks very much.

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default How to dynamically add up varying # of cells base on a value

You're welcome. Thanks for the feedback!

--
Biff
Microsoft Excel MVP


"Felicia" wrote in message
...
This works great, exactly what I needed. Thanks very much, Biff !

Felicia

"T. Valko" wrote:

Try this:

=SUM(A1:INDEX(A1:L1,n))

Where n = a number or a reference to a cell that holds the number.

A5 = 6

=SUM(A1:INDEX(A1:L1,A5))

That will sum A1:F1. If A5 is an empty cell the formula will calculate
the
entire range.

--
Biff
Microsoft Excel MVP


"Felicia" wrote in message
...
How do I get a formula to decide on the # of cells to add up base on
the
value in another cell.

For example, column A to L contains the $saving for each months of
the
year from Jan to Dec. And say that savings for the first x months of
the
year could be carried over from the previous year; and that x value is
reflected in column M. And I want to know the total $saving that is
carried
over from the previous year. So, how do get the formula to add up the
first
x number of months and put the value in column O.


Jan Saving Feb Saving Mar Saving Apr Saving May Saving Jun
Saving Jul Saving Aug Saving Sep Saving Oct Saving Nov Saving
Dec Saving # Months carried over Savings Carried Over
100 200 150 160 300 350 400 200 200 300 300 400 4 610
100 100 200 250 150 700 600 700 600 500 550 500 5 800
300 400 300 250 200 800 300 500 600 500 550 500 0 0





Thanks very much.






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
Varying selected cells returning value always to the same cell jk Excel Discussion (Misc queries) 3 November 18th 08 05:33 PM
Adding cells that have varying contents Pierre Excel Worksheet Functions 5 September 12th 07 02:57 AM
locking cells dynamically Deano Excel Worksheet Functions 1 August 20th 07 03:26 PM
Copying cells from varying rows annettek Excel Discussion (Misc queries) 2 May 25th 07 02:51 PM
concatenate with a varying range of cells Riversage Excel Worksheet Functions 0 January 29th 07 07:43 PM


All times are GMT +1. The time now is 06:05 PM.

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

About Us

"It's about Microsoft Excel"