How do you sum every 5 rows in a column, obtaining the result in the adjacent column?

samtheman88

New Member
Joined
Feb 6, 2013
Messages
7
Hello,

I'm working with about 1400 lines in excel: I simply need to sum every 5 rows in a single column, and report the result in the adjacent column. For example, the data I am trying to sum is an column G. I would like to sum G2:G6, G7:G11 etc...and have the result be reported in H1, H2..etc. Any help would be very much appreciated!!!
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Here’s how you can incrementally sum a range of cells. In the pictured example, each set of five cells in range D2:D26 are summed in range G2:G6.
The formula in cell G2 and copied down to cell G6 is
<CODE>=SUM(OFFSET($D$2,(ROW()-ROW($D$2))*5,0,5,1))</CODE>
You can do this with any incremental count; it need not be 5 cells. For example, if you want to sum each set of 9 cells, your formula would be modified like this:
<CODE>=SUM(OFFSET($D$2,(ROW()-ROW($D$2))*9,0,9,1))</CODE>

I used cells in column D to fit in the picture; change cell references in the formula as needed.



 
Upvote 0
Or try this macro
Code:
Sub SumEvery5Rows()
Dim i As Long, lr As Long
Dim x As Integer, y As Integer
lr = Cells(Rows.Count, "G").End(xlUp).Row
y = 1
For i = 2 To lr Step 5
    y = y + 1
    x = Evaluate("Sum(G" & i & ":G" & i + 4 & ")")
    Range("H" & y).Value = x
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top