VBA code for averaging every 12 cells in column of data

mdavid800

New Member
Joined
Jul 27, 2011
Messages
6
Hi there I am looking for some help

I’m looking for a VBA code that will give me the averages of every 12 cells in a column of data.

What I have is data in cells “C35” to “C8928” what I want to do is average every 12 cells( i.e. cells C35 to C46 and then C47 to C58 and so on ) using VBA and then show the averages in column F from cells F1 to F744 (as I would have 744 averages).

Ive tried a number of ways of doing this but nothing seems to be working and have come looking for some help again from the forum.

Thank you in Advance

David
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Try

Code:
Sub test()
Dim i As Long
For i = 35 To 8919 Step 12
    Range("F" & Rows.Count).End(xlUp).Offset(1).Value = WorksheetFunction.Average(Range("C" & i).Resize(12))
Next i
End Sub
 
Upvote 0
If you want to avoid code you could enter this in F1 and copy down

=AVERAGE(INDIRECT(ADDRESS(35+(ROW()-1)*12,3) & ":" & ADDRESS(46+(ROW()-1)*12,3)))
 
Upvote 0

Forum statistics

Threads
1,224,596
Messages
6,179,807
Members
452,944
Latest member
2558216095

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