Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 148
Default SumIf across columns instead of rows

to I have a set of metrics that are laid out horizontally in a spreadsheet,
and I need to sum up every other column. Is there a way to use SumIf or a
similar formula so I don't have type each cell into a Sum function? Currently
my formula is
=SUM(B6+D6+F6+H6+J6+L6+N6+P6+R6+T6+V6+X6+Z6+AB6+AD 6+AF6+AH6+AJ6+AL6+AN6+AP6)
which is very error prone and manual to update when I add a column. Each
column to be added has a column header of "Total" so I tried
=sumif(B5:AQ5,"TOTAL",B6:AQ6) but it returns zero. I also tried
sumif(A:AQ,mod(column(),2)=0,B6:AQ6) and got zero also.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default SumIf across columns instead of rows

If the values that you're trying to add are really text, then using + will make
excel treat them like real numbers.

So what does:
=SUM(B6,D6,F6,H6,J6,L6,N6,P6,R6,T6,V6,X6,Z6,AB6,AD 6,AF6,AH6,AJ6,AL6,AN6,AP6)
Return.

If this returns 0, then those values maybe text (or just coincidentally sum to
0???).

I'd try reformatting each cell as General
then reenter the values (hit F2, then enter will be enough)

You could also select an empty cell
edit|copy
then select the range to fix
edit|paste special|check add and values

====
Just an aside:

I like this formula that you suggested:
=sumif(B5:AQ5,"TOTAL",B6:AQ6)
And if you have total as part of the header, you could use:
=sumif(B5:AQ5,"*TOTAL*",B6:AQ6)

=sumif() will work nicely with wildcards.


Heather wrote:

to I have a set of metrics that are laid out horizontally in a spreadsheet,
and I need to sum up every other column. Is there a way to use SumIf or a
similar formula so I don't have type each cell into a Sum function? Currently
my formula is
=SUM(B6+D6+F6+H6+J6+L6+N6+P6+R6+T6+V6+X6+Z6+AB6+AD 6+AF6+AH6+AJ6+AL6+AN6+AP6)
which is very error prone and manual to update when I add a column. Each
column to be added has a column header of "Total" so I tried
=sumif(B5:AQ5,"TOTAL",B6:AQ6) but it returns zero. I also tried
sumif(A:AQ,mod(column(),2)=0,B6:AQ6) and got zero also.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,651
Default SumIf across columns instead of rows

What did you want the SUM function to add to
B6+D6+F6+H6+J6+L6+N6+P6+R6+T6+V6+X6+Z6+AB6+AD6+AF6 +AH6+AJ6+AL6+AN6+AP6 ?
If what you wanted was
=B6+D6+F6+H6+J6+L6+N6+P6+R6+T6+V6+X6+Z6+AB6+AD6+AF 6+AH6+AJ6+AL6+AN6+AP6 then
you don't need the SUM function.
If you want to use the SUM function, you could use
=SUM(B6,D6,F6,H6,J6,L6,N6,P6,R6,T6,V6,X6,Z6,AB6,AD 6,AF6,AH6,AJ6,AL6,AN6,AP6)
--
David Biddulph

"Heather" wrote in message
...
to I have a set of metrics that are laid out horizontally in a
spreadsheet,
and I need to sum up every other column. Is there a way to use SumIf or a
similar formula so I don't have type each cell into a Sum function?
Currently
my formula is
=SUM(B6+D6+F6+H6+J6+L6+N6+P6+R6+T6+V6+X6+Z6+AB6+AD 6+AF6+AH6+AJ6+AL6+AN6+AP6)
which is very error prone and manual to update when I add a column. Each
column to be added has a column header of "Total" so I tried
=sumif(B5:AQ5,"TOTAL",B6:AQ6) but it returns zero. I also tried
sumif(A:AQ,mod(column(),2)=0,B6:AQ6) and got zero also.



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default SumIf across columns instead of rows

Hi,

This adds every other column starting with B

=SUMPRODUCT(--(MOD(COLUMN(B6:K6),2)=0),B6:K6)

This adds every other column starting with C

=SUMPRODUCT(--(MOD(COLUMN(B6:K6),2)=1),B6:K6)
--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Heather" wrote:

to I have a set of metrics that are laid out horizontally in a spreadsheet,
and I need to sum up every other column. Is there a way to use SumIf or a
similar formula so I don't have type each cell into a Sum function? Currently
my formula is
=SUM(B6+D6+F6+H6+J6+L6+N6+P6+R6+T6+V6+X6+Z6+AB6+AD 6+AF6+AH6+AJ6+AL6+AN6+AP6)
which is very error prone and manual to update when I add a column. Each
column to be added has a column header of "Total" so I tried
=sumif(B5:AQ5,"TOTAL",B6:AQ6) but it returns zero. I also tried
sumif(A:AQ,mod(column(),2)=0,B6:AQ6) and got zero also.

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
Excel 2003 - change columns to rows and rows to columns Trish Excel Discussion (Misc queries) 0 August 17th 07 02:22 AM
Excel 2003 - change columns to rows and rows to columns JLatham Excel Discussion (Misc queries) 0 August 17th 07 02:05 AM
how to interchange rows to columns & columns to rows in a table kotakkamlesh Excel Discussion (Misc queries) 1 July 10th 06 07:58 AM
SUMIF with rows and columns David Howdon Excel Worksheet Functions 5 October 17th 05 05:48 PM
sumif columns and rows Paul Clough Excel Worksheet Functions 2 November 22nd 04 05:01 PM


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