Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
valaor
 
Posts: n/a
Default summing non contiguous ranges

I need to sum cells A1:A5, C1:C5, E1:E5 etc, i.e. the first top 5 cells in
every second column. I must sum more than 50 such ranges, so SUM(A1:A5,
C1:C5, ...) is not an option. Can this be done with formulas?
  #2   Report Post  
Posted to microsoft.public.excel.misc
Clivey_UK
 
Posts: n/a
Default summing non contiguous ranges


There is probably a more elegant way of doing this, but if you put this
formula in A6 and copied it across all the rows you'd get the sum of
every other column:
=IF(COLUMN(A1)=ODD(COLUMN(A1)),SUM(A1:A5),"")
Basically it sums the column if the column is an odd number (1, 3, 5
etc). Then sum the total of this row to give the total of every second
row in all the columns.
If I haven't understood the problem, please explain a little further.
Clive


valaor Wrote:
I need to sum cells A1:A5, C1:C5, E1:E5 etc, i.e. the first top 5 cells
in
every second column. I must sum more than 50 such ranges, so
SUM(A1:A5,
C1:C5, ...) is not an option. Can this be done with formulas?



--
Clivey_UK
------------------------------------------------------------------------
Clivey_UK's Profile: http://www.excelforum.com/member.php...o&userid=32569
View this thread: http://www.excelforum.com/showthread...hreadid=525196

  #3   Report Post  
Posted to microsoft.public.excel.misc
Ardus Petus
 
Posts: n/a
Default summing non contiguous ranges

If you have only 5 rows, you can write:
=SUMPRODUCT(--(MOD(COLUMN(A1:K5),2)=1),A1:K1+A2:K2+A3:K3+A4:K4+A 5:K5)

I could not find any shorter

HTH
--
AP

"valaor" a écrit dans le message de
...
I need to sum cells A1:A5, C1:C5, E1:E5 etc, i.e. the first top 5 cells in
every second column. I must sum more than 50 such ranges, so SUM(A1:A5,
C1:C5, ...) is not an option. Can this be done with formulas?



  #4   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student
 
Posts: n/a
Default summing non contiguous ranges

Very easy:

Just select all the cell-sets you want to sum and pull-down:

Insert Name define

and enter a name like disjoint.


Then just use =SUM(disjoint)
--
Gary''s Student


"valaor" wrote:

I need to sum cells A1:A5, C1:C5, E1:E5 etc, i.e. the first top 5 cells in
every second column. I must sum more than 50 such ranges, so SUM(A1:A5,
C1:C5, ...) is not an option. Can this be done with formulas?

  #5   Report Post  
Posted to microsoft.public.excel.misc
valaor
 
Posts: n/a
Default summing non contiguous ranges

Thanks for the tip. From your post I got this idea for shortening the formula:

=SUMPRODUCT(A1:DL5*(MOD(COLUMN(A1:DL5),2)=1))

It works. Thanks again. I now have a next question: If the ranges are not
evenly spaced, they are still in rows 1-5, but in various columns, not every
two. Is there a way to have an extra table with the column names holding
"sensitive" data and use this?

"Ardus Petus" wrote:

If you have only 5 rows, you can write:
=SUMPRODUCT(--(MOD(COLUMN(A1:K5),2)=1),A1:K1+A2:K2+A3:K3+A4:K4+A 5:K5)

I could not find any shorter

HTH
--
AP

"valaor" a écrit dans le message de
...
I need to sum cells A1:A5, C1:C5, E1:E5 etc, i.e. the first top 5 cells in
every second column. I must sum more than 50 such ranges, so SUM(A1:A5,
C1:C5, ...) is not an option. Can this be done with formulas?






  #6   Report Post  
Posted to microsoft.public.excel.misc
Ardus Petus
 
Posts: n/a
Default summing non contiguous ranges

Try INDIRECT

--
AP

"valaor" a écrit dans le message de
...
Thanks for the tip. From your post I got this idea for shortening the

formula:

=SUMPRODUCT(A1:DL5*(MOD(COLUMN(A1:DL5),2)=1))

It works. Thanks again. I now have a next question: If the ranges are not
evenly spaced, they are still in rows 1-5, but in various columns, not

every
two. Is there a way to have an extra table with the column names holding
"sensitive" data and use this?

"Ardus Petus" wrote:

If you have only 5 rows, you can write:
=SUMPRODUCT(--(MOD(COLUMN(A1:K5),2)=1),A1:K1+A2:K2+A3:K3+A4:K4+A 5:K5)

I could not find any shorter

HTH
--
AP

"valaor" a écrit dans le message de
...
I need to sum cells A1:A5, C1:C5, E1:E5 etc, i.e. the first top 5

cells in
every second column. I must sum more than 50 such ranges, so

SUM(A1:A5,
C1:C5, ...) is not an option. Can this be done with formulas?






  #7   Report Post  
Posted to microsoft.public.excel.misc
valaor
 
Posts: n/a
Default summing non contiguous ranges

I did, and it seems I have reached a limit. Initially I was enthusiastic
about the prospect. I tried several variants and always got unwanted results
or errors. After several attempts I tried putting the ranges a1:a5, c1:c5 as
text in cells k1:k4. I tried:

=SUM(INDIRECT(INDEX(K1:K4,ROW(1:4))))

I entered it as an array formula. Still, it only recognizes the first range
a1:a5. After some more search I thought of using N

=SUM(N(INDIRECT(INDEX(K1:K4,ROW(1:4)))))

and it got even worse. It only recognizes a1. Is this impossible? Is there
another way of using indirect here?

"Ardus Petus" wrote:

Try INDIRECT

--
AP


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
Named Ranges Joe Gieder Excel Worksheet Functions 2 February 16th 06 01:31 AM
sorting non contiguous ranges gsh20 Excel Discussion (Misc queries) 1 September 8th 05 04:50 PM
Summing moving ranges & dates Spartacus Excel Worksheet Functions 3 August 10th 05 12:55 AM
compare unique identifiers in multiple ranges bawilli_91125 Charts and Charting in Excel 1 November 30th 04 06:34 PM
Named dynamic ranges, copied worksheets and graph source data WP Charts and Charting in Excel 1 November 28th 04 05:19 PM


All times are GMT +1. The time now is 10:50 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"