Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CB CB is offline
external usenet poster
 
Posts: 60
Default Sum even columns

I am using MS Vista and Excel 2007. My question is how do I sum even columns
in a spreadsheet? My spreadsheet is set up in the following manner:

11/7/08 11/14/08 11/24/08
Col A1 Col B1 Col C1 Col D1 Col E1 Col F1 Col
G1...etc
Sold to 20 $20.00 10 $10.00 5 $5.00

In column B1, D1 and F1 I have a number and in column C1, E1 and G1 I have
an associated cost. The spreadsheet can require expansion to the right to
column EZ. My question is how do I sum Column B1, D1...EZ1 in a
predetermined cell (FA1)? I cannont use the sum function as it has a limit
on the number of individually selected cells that can be summed. Is there a
way to tell it to sum starting at B1 every other cell to the right stopping
at EZ1?

Thanks in advance for your help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Sum even columns

=SUMPRODUCT(--(MOD(COLUMN(B1:EZ1),2)=0),B1:EZ1)
--
Gary''s Student - gsnu200823


"CB" wrote:

I am using MS Vista and Excel 2007. My question is how do I sum even columns
in a spreadsheet? My spreadsheet is set up in the following manner:

11/7/08 11/14/08 11/24/08
Col A1 Col B1 Col C1 Col D1 Col E1 Col F1 Col
G1...etc
Sold to 20 $20.00 10 $10.00 5 $5.00

In column B1, D1 and F1 I have a number and in column C1, E1 and G1 I have
an associated cost. The spreadsheet can require expansion to the right to
column EZ. My question is how do I sum Column B1, D1...EZ1 in a
predetermined cell (FA1)? I cannont use the sum function as it has a limit
on the number of individually selected cells that can be summed. Is there a
way to tell it to sum starting at B1 every other cell to the right stopping
at EZ1?

Thanks in advance for your help.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Sum even columns

One way:

=SUMPRODUCT(1:1,--(MOD(COLUMN(1:1),2)=0))

In article ,
CB wrote:

I am using MS Vista and Excel 2007. My question is how do I sum even columns
in a spreadsheet? My spreadsheet is set up in the following manner:

11/7/08 11/14/08 11/24/08
Col A1 Col B1 Col C1 Col D1 Col E1 Col F1 Col
G1...etc
Sold to 20 $20.00 10 $10.00 5 $5.00

In column B1, D1 and F1 I have a number and in column C1, E1 and G1 I have
an associated cost. The spreadsheet can require expansion to the right to
column EZ. My question is how do I sum Column B1, D1...EZ1 in a
predetermined cell (FA1)? I cannont use the sum function as it has a limit
on the number of individually selected cells that can be summed. Is there a
way to tell it to sum starting at B1 every other cell to the right stopping
at EZ1?

Thanks in advance for your help.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Sum even columns

On 5 Gen, 21:28, CB wrote:
I am using MS Vista and Excel 2007. *My question is how do I sum even columns
in a spreadsheet? *My spreadsheet is set up in the following manner:

* * * * * * * * * 11/7/08 * * * * * * * *11/14/08 * * * * * *11/24/08 *
Col A1 * * * *Col B1 * * *Col C1 * *Col D1 * Col E1 * *Col F1 * * * Col
G1...etc
Sold to * * * *20 * * * * * *$20.00 * *10 * * * *$10.00 * *5 * * * * * *$5.00

In column B1, D1 and F1 I have a number and in column C1, E1 and G1 I have
an associated cost. *The spreadsheet can require expansion to the right to
column EZ. *My question is how do I sum Column B1, D1...EZ1 in a
predetermined cell (FA1)? *I cannont use the sum function as it has a limit
on the number of individually selected cells that can be summed. *Is there a
way to tell it to sum starting at B1 every other cell to the right stopping
at EZ1?

Thanks in advance for your help.


Hi CB.
Try also:

Public Sub prova()
Dim c As Long
Dim r As Long
Dim totale As Long
For r = 2 To 100
totale = 0
If Cells(r, 1).Value = "" Then Exit Sub
For c = 1 To 156 Step 2
totale = totale + Cells(r, c).Value
Next
Cells(r, c + 1).Value = totale
Next
End Sub

Regards
Eliano
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Sum even columns

When I fill down, I get Gary"s function to work, but not the one posted by JE
McGimpsey. Maybe it should be something like this:
=SUMPRODUCT(A1:Z1,--(MOD(COLUMN(A1:Z1),2)=0))
Then, when you fill down, it seems to work.

Ryan---



--
RyGuy


"eliano" wrote:

On 5 Gen, 21:28, CB wrote:
I am using MS Vista and Excel 2007. My question is how do I sum even columns
in a spreadsheet? My spreadsheet is set up in the following manner:

11/7/08 11/14/08 11/24/08
Col A1 Col B1 Col C1 Col D1 Col E1 Col F1 Col
G1...etc
Sold to 20 $20.00 10 $10.00 5 $5.00

In column B1, D1 and F1 I have a number and in column C1, E1 and G1 I have
an associated cost. The spreadsheet can require expansion to the right to
column EZ. My question is how do I sum Column B1, D1...EZ1 in a
predetermined cell (FA1)? I cannont use the sum function as it has a limit
on the number of individually selected cells that can be summed. Is there a
way to tell it to sum starting at B1 every other cell to the right stopping
at EZ1?

Thanks in advance for your help.


Hi CB.
Try also:

Public Sub prova()
Dim c As Long
Dim r As Long
Dim totale As Long
For r = 2 To 100
totale = 0
If Cells(r, 1).Value = "" Then Exit Sub
For c = 1 To 156 Step 2
totale = totale + Cells(r, c).Value
Next
Cells(r, c + 1).Value = totale
Next
End Sub

Regards
Eliano



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Sum even columns

Hmmm... the formula posted works fine here when copied down. What
"didn't work" for you?


In article ,
ryguy7272 wrote:

When I fill down, I get Gary"s function to work, but not the one posted by JE
McGimpsey. Maybe it should be something like this:
=SUMPRODUCT(A1:Z1,--(MOD(COLUMN(A1:Z1),2)=0))
Then, when you fill down, it seems to work.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Sum even columns

False alarm. Sorry, JE McGimpsey, your function didn't seem to work on my
office laptop, but when I tried it on my home laptop it worked just fine.
Maybe some setting on my version of Excel in the office... I know
Auto-Calculation was turned on. Not sure what happened. Sorry 'bout that!
:)

Ryan--

--
RyGuy


"JE McGimpsey" wrote:

Hmmm... the formula posted works fine here when copied down. What
"didn't work" for you?


In article ,
ryguy7272 wrote:

When I fill down, I get Gary"s function to work, but not the one posted by JE
McGimpsey. Maybe it should be something like this:
=SUMPRODUCT(A1:Z1,--(MOD(COLUMN(A1:Z1),2)=0))
Then, when you fill down, it seems to work.


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
Make Columns A&B on Sheet2 always equal Sheet1 table columns A&B KnightBall Setting up and Configuration of Excel 6 August 18th 09 05:48 PM
putting 2 long columns into multiple columns in excel page and sor bob_mhc Excel Discussion (Misc queries) 1 April 25th 08 07:51 AM
Help in code Steve G wrote to move data from 4 columns to 21 columns Steve G Excel Programming 9 August 2nd 07 02:43 PM
Combine multiple columns into two long columns, Repeating rows in first column [email protected] Excel Discussion (Misc queries) 2 July 31st 06 09:45 PM
Combine multiple columns into two long columns, Repeating rows in first column [email protected] Excel Discussion (Misc queries) 0 July 31st 06 05:07 PM


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