Hi,

I am trying to write a VBA script so I can take the average of sample data that falls within the specific time range for the respective date for a matching column. The data is captured every 20sec when the system is on and creates an excel file "Data". I need to perform reporting and analytics for that data hence I created a new excel file named "Table" with 15 min time increments.

I used one of my old codes along with some help online however, I am not getting anywhere. Hence would appreciate any help.

What I am trying to achieve here : For every data sample that belongs to that 15 min interval whether its 1 entry or 300 entries (20sec *15), the cell in the main "table" file would be the average of the data set within the data file for the respective date and respective column header. similarly it should then move on to the next column header and do the same average for the data set for that 15 min interval and after it has copied data for all the column headers then it moves to the next set of time interval.

Attaching two sample files Data & Table. I have filled the Table file manually for now but I would like a VBA script for that.

Sample filled "Table" File : for time range B3 & C3 and column header "A" the average value entered is 1.222 and so on...

The value 1.222 is the average value from "Data" file C3:C8 for column header "A" as the datestamp in column B falls between the time range in Table file for Row 3.

Table.xlsmData.xlsx