Summing every third cell

J

Jason Hancock

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!
 
A

Alan Beban

Jason said:
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
 
A

Alan Beban

Jason said:
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
 
J

Jason Hancock

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!
 
A

Alan Beban

Leo said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top