I need a VBA to select and average cells in a loop

Linkey

New Member
Joined
Nov 23, 2020
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello,

I need a VBA code that can select 30 cells at a time from worksheet 1 and paste the average of those cells into a table in worksheet 2

This is a dataset of temperature measurements that were taken at 1 minute intervals for 14 days which I need to get the average of each 30 minute interval for. I tried using the Macro recorder but couldn't get it to average the consecutive intervals. The idea of manually going down 20161 rows is horrifying

Here is what the data looks like - it's pretty basic
Sheet 1
1606156175079.png


Sheet 2
1606156209096.png


I've been trying to code a sub loops () but I have no experience in coding so it keeps on giving errors or not doing the right thing

Any help would really be appreciated!!
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
You could do this with a pivot table with Time(min) as a row value grouped by 30.
 
Upvote 0
You could do this with a pivot table with Time(min) as a row value grouped by 30.
I didn't think of that, played around with it and figured it out in the PivotTable. Thank you!
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,693
Members
448,979
Latest member
DET4492

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