Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 4
Post Controlling Cells included in a sum command

Hi,

I need to be able to control the cells that are summed by a number in another cell.

My current sum statement is =SUM (L102,T102,X102,AD102,AJ102).

I need to use the value is cell A1 to indicate how many of the summed cells to included.

For instance if A1=1 then cell L102 is included in the sum. If A1=2 then L102 and T102 would be included in the sum.
Any help would be greatly appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 829
Default Controlling Cells included in a sum command

"Jim Schnur" wrote:
I need to be able to control the cells that are summed by a number
in another cell.
My current sum statement is =SUM (L102,T102,X102,AD102,AJ102).
I need to use the value is cell A1 to indicate how many of the
summed cells to included.
For instance if A1=1 then cell L102 is included in the sum.
If A1=2 then L102 and T102 would be included in the sum.


One way....

Create a table in a range, for example:

X1: =L102
X2: =T102
X3: =X102
X4: =AD102
X5: =AJ102

Then the SUM formula can be:

=SUM(X1:INDEX(X1:X5,A1))
  #3   Report Post  
Member
 
Posts: 93
Default

Hi

Maybe using a IF function could be one option: =IF(A1=1,SUM(L102),IF(A1=2,SUM(L102,T102),IF(A1=3, SUM(L102,T102,X102),IF(A1=4,SUM(L102,T102,X102,AD1 02),IF(A1=5,SUM(L102,T102,X102,AD102,AJ102))))))

Quote:
Originally Posted by Jim Schnur View Post
Hi,

I need to be able to control the cells that are summed by a number in another cell.

My current sum statement is =SUM (L102,T102,X102,AD102,AJ102).

I need to use the value is cell A1 to indicate how many of the summed cells to included.

For instance if A1=1 then cell L102 is included in the sum. If A1=2 then L102 and T102 would be included in the sum.
Any help would be greatly appreciated.
  #4   Report Post  
Junior Member
 
Posts: 4
Thumbs up

Quote:
Originally Posted by joeu2004[_2_] View Post
"Jim Schnur" wrote:
I need to be able to control the cells that are summed by a number
in another cell.
My current sum statement is =SUM (L102,T102,X102,AD102,AJ102).
I need to use the value is cell A1 to indicate how many of the
summed cells to included.
For instance if A1=1 then cell L102 is included in the sum.
If A1=2 then L102 and T102 would be included in the sum.


One way....

Create a table in a range, for example:

X1: =L102
X2: =T102
X3: =X102
X4: =AD102
X5: =AJ102

Then the SUM formula can be:

=SUM(X1:INDEX(X1:X5,A1))
Thank you.......
  #5   Report Post  
Junior Member
 
Posts: 4
Thumbs up

Quote:
Originally Posted by Kevin@Radstock View Post
Hi

Maybe using a IF function could be one option: =IF(A1=1,SUM(L102),IF(A1=2,SUM(L102,T102),IF(A1=3, SUM(L102,T102,X102),IF(A1=4,SUM(L102,T102,X102,AD1 02),IF(A1=5,SUM(L102,T102,X102,AD102,AJ102))))))
Thank You... This will work for me Kevin...
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
Avoiding cells being included in a chart F[_2_] Excel Programming 2 December 10th 11 10:20 AM
command button controlling a range of dates RedBeard Excel Programming 1 December 9th 09 11:29 AM
Cells not included in formulas Knucklehead Excel Discussion (Misc queries) 3 July 22nd 08 06:25 PM
Range of variables with the 'floor' command included ReelDesigner Excel Worksheet Functions 0 January 26th 06 04:05 PM
Controlling size of command buttons pagelocator Excel Discussion (Misc queries) 1 October 13th 05 02:01 PM


All times are GMT +1. The time now is 05:40 AM.

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"