ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Summing every third cell (https://www.excelbanter.com/excel-programming/303153-summing-every-third-cell.html)

Jason Hancock

Summing every third cell
 
Well, I've tried several different things, but have not been successful.
I'm trying to sum every third row of a particular column (i.e.
A2+A5+...) What I have written so far is:

For n = 2 To 233 Step 3
For m = 4 To 15 Step 1
Cells(236, m).FormulaR1C1 = ??????
Cells(236, m).NumberFormat = "$#,##0_);[Red]($#,##0)"
Next
Next

Any help would be great. Thanks!

Jason

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Don Guillett[_4_]

Summing every third cell
 
see worksheet.functions for subj
sum every other row in column

--
Don Guillett
SalesAid Software

"Jason Hancock" wrote in message
...
Well, I've tried several different things, but have not been successful.
I'm trying to sum every third row of a particular column (i.e.
A2+A5+...) What I have written so far is:

For n = 2 To 233 Step 3
For m = 4 To 15 Step 1
Cells(236, m).FormulaR1C1 = ??????
Cells(236, m).NumberFormat = "$#,##0_);[Red]($#,##0)"
Next
Next

Any help would be great. Thanks!

Jason

*** Sent via Devdex
http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!




Alan Beban[_2_]

Summing every third cell
 
Jason Hancock wrote:

Well, I've tried several different things, but have not been successful.
I'm trying to sum every third row of a particular column (i.e.
A2+A5+...)


Sub a()
Dim sSum As Double, i As Long
For i = 2 To 11 Step 3
sSum = sSum + Application.Sum(Range("A" & i))
Next
End Sub

Alan Beban

Alan Beban[_2_]

Summing every third cell
 
Jason Hancock wrote:

Well, I've tried several different things, but have not been successful.
I'm trying to sum every third row of a particular column (i.e.
A2+A5+...)


Without using VBA you can insert the following in the first cell of an
empty column (say, Column N)

=INDIRECT("A"&3*ROW()-1)

Then in the first cell of the next column (say, Column O)

=SUM(N:N)

The desired result will be in Cell O1

Alan Beban

Jason Hancock

Summing every third cell
 
I've put this together, however I'm getting a runtime error 1004.
Anything I'm missing?

For i = 2 To 233 Step 3
For n = 3 To 15 Step 1
Cells(236, n).Formula = sSum = sSum +
Application.Sum(Range(n & i))
Cells(236, n).NumberFormat = "$#,##0_);[Red]($#,##0)"
Next
Next


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Leo Heuser[_3_]

Summing every third cell
 
Or in one cell:

=SUMPRODUCT((A3:A200)*(MOD(ROW(A3:A200)-ROW(A3),3)=0))

--
Best Regards
Leo Heuser

Followup to newsgroup only please.

"Alan Beban" skrev i en meddelelse
...
Jason Hancock wrote:

Well, I've tried several different things, but have not been successful.
I'm trying to sum every third row of a particular column (i.e.
A2+A5+...)


Without using VBA you can insert the following in the first cell of an
empty column (say, Column N)

=INDIRECT("A"&3*ROW()-1)

Then in the first cell of the next column (say, Column O)

=SUM(N:N)

The desired result will be in Cell O1

Alan Beban




Alan Beban[_2_]

Summing every third cell
 
Leo Heuser wrote:

Or in one cell:

=SUMPRODUCT((A3:A200)*(MOD(ROW(A3:A200)-ROW(A3),3)=0))

I take it that to sum A2,A5,A8,etc., it should be A2 instead of A3?

Alan Beban

Leo Heuser[_3_]

Summing every third cell
 

"Alan Beban" skrev i en meddelelse
...
Leo Heuser wrote:

Or in one cell:

=SUMPRODUCT((A3:A200)*(MOD(ROW(A3:A200)-ROW(A3),3)=0))

I take it that to sum A2,A5,A8,etc., it should be A2 instead of A3?

Alan Beban


You're not a man easily fooled <g
Thanks.

LeoH




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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com