Fringedweller
New Member
- Joined
- Jan 21, 2018
- Messages
- 6
I am hoping that someone can help me with a macro to average data from multiple time points
Simply i have a 4 columns Day, Date, Time, Data
The same format appears on each worksheet with in the workbook which i need sort and Average over the data range
The data sort should be by date (ascending) then by Time (Ascending)
Time is based on a 24 Hour period data points can arrive at any point during this period
I would like to add that i have tried to do it my self using the inbuilt sort functions but can no seem to get it to work across multiple sheets
also i got lost in the Pivot table grouping options
Cell range on all worksheets is Range("A2:D500") Includes headers A2-D2
I guess the output columns would be F2:G500 F=Time(whole Hour, example 1am, 2am, 3am ..etc) g= averaged data from previous time until current time
Then i can Graph the averages of a week based on date and hourly intervals for each worksheeet
my goal is then combine all worksheets into a single graph using each worksheets title as labels
example of data
[TABLE="width: 205"]
<colgroup><col style="text-align: center;"><col style="text-align: center;"><col style="text-align: center;"><col style="text-align: center;"></colgroup><tbody>[TR]
[TD="align: center"]Day[/TD]
[TD="align: center"]Date[/TD]
[TD="align: center"] Time[/TD]
[TD="align: center"]Data[/TD]
[/TR]
[TR]
[TD="align: center"]Sat[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]23:37:29[/TD]
[TD="align: center"]1.2[/TD]
[/TR]
[TR]
[TD="align: center"]Sat[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]23:27:46[/TD]
[TD="align: center"]1.2[/TD]
[/TR]
[TR]
[TD="align: center"]Sat[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]20:45:09[/TD]
[TD="align: center"]1.2[/TD]
[/TR]
[TR]
[TD="align: center"]Sat[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]20:41:54[/TD]
[TD="align: center"]1.7[/TD]
[/TR]
[TR]
[TD="align: center"]Sat[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]20:38:39[/TD]
[TD="align: center"]2.3[/TD]
[/TR]
[TR]
[TD="align: center"]Sat[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]20:35:24[/TD]
[TD="align: center"]1.9[/TD]
[/TR]
[TR]
[TD="align: center"]Sat[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]18:21:51[/TD]
[TD="align: center"]1.4[/TD]
[/TR]
[TR]
[TD="align: center"]Sat[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]12:32:57[/TD]
[TD="align: center"]1.2[/TD]
[/TR]
[TR]
[TD="align: center"]Sat[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]12:29:42[/TD]
[TD="align: center"]1.4[/TD]
[/TR]
[TR]
[TD="align: center"]Fri[/TD]
[TD="align: center"]19[/TD]
[TD="align: center"]21:14:29[/TD]
[TD="align: center"]1.2[/TD]
[/TR]
[TR]
[TD="align: center"]Fri[/TD]
[TD="align: center"]19[/TD]
[TD="align: center"]17:20:28[/TD]
[TD="align: center"]1.2[/TD]
[/TR]
[TR]
[TD="align: center"]Fri[/TD]
[TD="align: center"]19[/TD]
[TD="align: center"]17:17:14[/TD]
[TD="align: center"]1.3[/TD]
[/TR]
[TR]
[TD="align: center"]Fri[/TD]
[TD="align: center"]19[/TD]
[TD="align: center"]17:13:57[/TD]
[TD="align: center"]1.2[/TD]
[/TR]
[TR]
[TD="align: center"]Fri[/TD]
[TD="align: center"]19[/TD]
[TD="align: center"]5:39:40[/TD]
[TD="align: center"]1.3[/TD]
[/TR]
[TR]
[TD="align: center"]Thu[/TD]
[TD="align: center"]18[/TD]
[TD="align: center"]4:09:20[/TD]
[TD="align: center"]1.2[/TD]
[/TR]
[TR]
[TD="align: center"]Wed[/TD]
[TD="align: center"]17[/TD]
[TD="align: center"]15:50:40[/TD]
[TD="align: center"]1.3[/TD]
[/TR]
[TR]
[TD="align: center"]Wed[/TD]
[TD="align: center"]17[/TD]
[TD="align: center"]13:21:03[/TD]
[TD="align: center"]1.3[/TD]
[/TR]
[TR]
[TD="align: center"]Wed[/TD]
[TD="align: center"]17[/TD]
[TD="align: center"]0:19:00[/TD]
[TD="align: center"]1.4[/TD]
[/TR]
[TR]
[TD="align: center"]Wed[/TD]
[TD="align: center"]17[/TD]
[TD="align: center"]0:15:49[/TD]
[TD="align: center"]1.5[/TD]
[/TR]
[TR]
[TD="align: center"]Wed[/TD]
[TD="align: center"]17[/TD]
[TD="align: center"]0:12:38[/TD]
[TD="align: center"]1.3[/TD]
[/TR]
[TR]
[TD="align: center"]Mon[/TD]
[TD="align: center"]15[/TD]
[TD="align: center"]20:32:29[/TD]
[TD="align: center"]1.4[/TD]
[/TR]
[TR]
[TD="align: center"]Mon[/TD]
[TD="align: center"]15[/TD]
[TD="align: center"]6:41:32[/TD]
[TD="align: center"]1.2[/TD]
[/TR]
[TR]
[TD="align: center"]Mon[/TD]
[TD="align: center"]15[/TD]
[TD="align: center"]6:38:19[/TD]
[TD="align: center"]1.3[/TD]
[/TR]
[TR]
[TD="align: center"]Sun[/TD]
[TD="align: center"]14[/TD]
[TD="align: center"]14:12:30[/TD]
[TD="align: center"]1.2[/TD]
[/TR]
[TR]
[TD="align: center"]Sun[/TD]
[TD="align: center"]14[/TD]
[TD="align: center"]14:09:15[/TD]
[TD="align: center"]1.4[/TD]
[/TR]
</tbody>[/TABLE]
I hope i have given enough information for someone to assist..
Cheers... any other questions please ask
Simply i have a 4 columns Day, Date, Time, Data
The same format appears on each worksheet with in the workbook which i need sort and Average over the data range
The data sort should be by date (ascending) then by Time (Ascending)
Time is based on a 24 Hour period data points can arrive at any point during this period
I would like to add that i have tried to do it my self using the inbuilt sort functions but can no seem to get it to work across multiple sheets
also i got lost in the Pivot table grouping options
Cell range on all worksheets is Range("A2:D500") Includes headers A2-D2
I guess the output columns would be F2:G500 F=Time(whole Hour, example 1am, 2am, 3am ..etc) g= averaged data from previous time until current time
Then i can Graph the averages of a week based on date and hourly intervals for each worksheeet
my goal is then combine all worksheets into a single graph using each worksheets title as labels
example of data
[TABLE="width: 205"]
<colgroup><col style="text-align: center;"><col style="text-align: center;"><col style="text-align: center;"><col style="text-align: center;"></colgroup><tbody>[TR]
[TD="align: center"]Day[/TD]
[TD="align: center"]Date[/TD]
[TD="align: center"] Time[/TD]
[TD="align: center"]Data[/TD]
[/TR]
[TR]
[TD="align: center"]Sat[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]23:37:29[/TD]
[TD="align: center"]1.2[/TD]
[/TR]
[TR]
[TD="align: center"]Sat[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]23:27:46[/TD]
[TD="align: center"]1.2[/TD]
[/TR]
[TR]
[TD="align: center"]Sat[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]20:45:09[/TD]
[TD="align: center"]1.2[/TD]
[/TR]
[TR]
[TD="align: center"]Sat[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]20:41:54[/TD]
[TD="align: center"]1.7[/TD]
[/TR]
[TR]
[TD="align: center"]Sat[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]20:38:39[/TD]
[TD="align: center"]2.3[/TD]
[/TR]
[TR]
[TD="align: center"]Sat[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]20:35:24[/TD]
[TD="align: center"]1.9[/TD]
[/TR]
[TR]
[TD="align: center"]Sat[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]18:21:51[/TD]
[TD="align: center"]1.4[/TD]
[/TR]
[TR]
[TD="align: center"]Sat[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]12:32:57[/TD]
[TD="align: center"]1.2[/TD]
[/TR]
[TR]
[TD="align: center"]Sat[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]12:29:42[/TD]
[TD="align: center"]1.4[/TD]
[/TR]
[TR]
[TD="align: center"]Fri[/TD]
[TD="align: center"]19[/TD]
[TD="align: center"]21:14:29[/TD]
[TD="align: center"]1.2[/TD]
[/TR]
[TR]
[TD="align: center"]Fri[/TD]
[TD="align: center"]19[/TD]
[TD="align: center"]17:20:28[/TD]
[TD="align: center"]1.2[/TD]
[/TR]
[TR]
[TD="align: center"]Fri[/TD]
[TD="align: center"]19[/TD]
[TD="align: center"]17:17:14[/TD]
[TD="align: center"]1.3[/TD]
[/TR]
[TR]
[TD="align: center"]Fri[/TD]
[TD="align: center"]19[/TD]
[TD="align: center"]17:13:57[/TD]
[TD="align: center"]1.2[/TD]
[/TR]
[TR]
[TD="align: center"]Fri[/TD]
[TD="align: center"]19[/TD]
[TD="align: center"]5:39:40[/TD]
[TD="align: center"]1.3[/TD]
[/TR]
[TR]
[TD="align: center"]Thu[/TD]
[TD="align: center"]18[/TD]
[TD="align: center"]4:09:20[/TD]
[TD="align: center"]1.2[/TD]
[/TR]
[TR]
[TD="align: center"]Wed[/TD]
[TD="align: center"]17[/TD]
[TD="align: center"]15:50:40[/TD]
[TD="align: center"]1.3[/TD]
[/TR]
[TR]
[TD="align: center"]Wed[/TD]
[TD="align: center"]17[/TD]
[TD="align: center"]13:21:03[/TD]
[TD="align: center"]1.3[/TD]
[/TR]
[TR]
[TD="align: center"]Wed[/TD]
[TD="align: center"]17[/TD]
[TD="align: center"]0:19:00[/TD]
[TD="align: center"]1.4[/TD]
[/TR]
[TR]
[TD="align: center"]Wed[/TD]
[TD="align: center"]17[/TD]
[TD="align: center"]0:15:49[/TD]
[TD="align: center"]1.5[/TD]
[/TR]
[TR]
[TD="align: center"]Wed[/TD]
[TD="align: center"]17[/TD]
[TD="align: center"]0:12:38[/TD]
[TD="align: center"]1.3[/TD]
[/TR]
[TR]
[TD="align: center"]Mon[/TD]
[TD="align: center"]15[/TD]
[TD="align: center"]20:32:29[/TD]
[TD="align: center"]1.4[/TD]
[/TR]
[TR]
[TD="align: center"]Mon[/TD]
[TD="align: center"]15[/TD]
[TD="align: center"]6:41:32[/TD]
[TD="align: center"]1.2[/TD]
[/TR]
[TR]
[TD="align: center"]Mon[/TD]
[TD="align: center"]15[/TD]
[TD="align: center"]6:38:19[/TD]
[TD="align: center"]1.3[/TD]
[/TR]
[TR]
[TD="align: center"]Sun[/TD]
[TD="align: center"]14[/TD]
[TD="align: center"]14:12:30[/TD]
[TD="align: center"]1.2[/TD]
[/TR]
[TR]
[TD="align: center"]Sun[/TD]
[TD="align: center"]14[/TD]
[TD="align: center"]14:09:15[/TD]
[TD="align: center"]1.4[/TD]
[/TR]
</tbody>[/TABLE]
I hope i have given enough information for someone to assist..
Cheers... any other questions please ask