UseLessFuel
New Member
- Joined
- Dec 22, 2012
- Messages
- 37
Hello. I am struggling with what may be quite simple. I am working with timestamped data in dd-mmm-yyyy hh:mm:ss format, where a value occurs every 5 minutes (but not exactly). I require to obtain an hourly average for each and every hour, which would normally be an average of the previous 12 cells (since the data is in 5 minute intervals). Example below:
[TABLE="width: 500"]
<tbody>[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 15:42:15
[/TD]
</tbody>[/TD]
[TD]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.8[/TD]
</tbody>
[/TD]
</tbody>[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 15:47:15
[/TD]
</tbody>[/TD]
[TD]
<colgroup><col style="mso-width-source:userset;mso-width-alt:3620;width:74pt" width="99"> </colgroup><tbody>
[TD="class: xl66, width: 99"]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.8[/TD]
</tbody>
[/TD]
[TD="class: xl66"][/TD]
</tbody>[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 15:52:16
[/TD]
</tbody>[/TD]
[TD]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.8[/TD]
</tbody>[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 15:57:17[/TD]
</tbody>[/TD]
[TD]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.8[/TD]
</tbody>[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 16:02:18[/TD]
</tbody>[/TD]
[TD]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.8[/TD]
</tbody>[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 16:07:19[/TD]
</tbody>[/TD]
[TD]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.8[/TD]
</tbody>[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 16:12:20[/TD]
</tbody>[/TD]
[TD]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.8[/TD]
</tbody>[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 16:17:20[/TD]
</tbody>[/TD]
[TD]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.8[/TD]
</tbody>[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 16:22:21[/TD]
</tbody>[/TD]
[TD]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.8[/TD]
</tbody>[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 16:27:22[/TD]
</tbody>[/TD]
[TD]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.8[/TD]
</tbody>[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 16:32:23[/TD]
</tbody>[/TD]
[TD]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.9[/TD]
</tbody>[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 16:37:24
[/TD]
[TD="class: xl65, width: 172, align: right"][/TD]
</tbody>[/TD]
[TD]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.9[/TD]
</tbody>[/TD]
[TD]
<colgroup><col width="80"></colgroup><tbody>
[TD="class: xl66, width: 80"]19.8[/TD]
</tbody>[/TD]
[/TR]
[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 16:42:25[/TD]
</tbody>[/TD]
[TD]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.9[/TD]
</tbody>[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
This particular dataset has 228,000 rows, and while almost all of the time intervals are between 5 minutes exactly, and 5.0333 minutes, there are instances of data-gaps, ranging from one timestamp missing, up to 7 days of data missing (= 2,000 records missing - I use the comma separator as a thousand separator). Also, there may be instances, where an hour of data may take 13 records, instead of 12, due to the slightly irregular time interval gaps. In the Table above, the 3rd column contains the average of the previous 12 records. My goal is to ascertain whether hourly records would be sufficient, since the values in the second column seem to change so little. It looks like I will also need the Max and Min values from each hour: crikey, it does look complex. Using MS Excel 2010, and Windows 7 Professional.
I am not experienced in VBA, although I have tinkered with it in the past. Any ideas?
(I can use Formulas, such as Countifs, Sumifs etc. and also Named ranges)
[TABLE="width: 500"]
<tbody>[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 15:42:15
[/TD]
</tbody>
[TD]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.8[/TD]
</tbody>
</tbody>
[TD][/TD]
[/TR]
[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 15:47:15
[/TD]
</tbody>
[TD]
<colgroup><col style="mso-width-source:userset;mso-width-alt:3620;width:74pt" width="99"> </colgroup><tbody>
[TD="class: xl66, width: 99"]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.8[/TD]
</tbody>
[TD="class: xl66"][/TD]
</tbody>
[TD][/TD]
[/TR]
[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 15:52:16
[/TD]
</tbody>
[TD]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.8[/TD]
</tbody>
[TD][/TD]
[/TR]
[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 15:57:17[/TD]
</tbody>
[TD]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.8[/TD]
</tbody>
[TD][/TD]
[/TR]
[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 16:02:18[/TD]
</tbody>
[TD]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.8[/TD]
</tbody>
[TD][/TD]
[/TR]
[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 16:07:19[/TD]
</tbody>
[TD]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.8[/TD]
</tbody>
[TD][/TD]
[/TR]
[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 16:12:20[/TD]
</tbody>
[TD]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.8[/TD]
</tbody>
[TD][/TD]
[/TR]
[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 16:17:20[/TD]
</tbody>
[TD]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.8[/TD]
</tbody>
[TD][/TD]
[/TR]
[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 16:22:21[/TD]
</tbody>
[TD]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.8[/TD]
</tbody>
[TD][/TD]
[/TR]
[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 16:27:22[/TD]
</tbody>
[TD]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.8[/TD]
</tbody>
[TD][/TD]
[/TR]
[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 16:32:23[/TD]
</tbody>
[TD]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.9[/TD]
</tbody>
[TD][/TD]
[/TR]
[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 16:37:24
[/TD]
[TD="class: xl65, width: 172, align: right"][/TD]
</tbody>
[TD]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.9[/TD]
</tbody>
[TD]
<colgroup><col width="80"></colgroup><tbody>
[TD="class: xl66, width: 80"]19.8[/TD]
</tbody>
[/TR]
[TR]
[TD]
<colgroup><col width="172"></colgroup><tbody>
[TD="class: xl65, width: 172, align: right"]15-Apr-2011 16:42:25[/TD]
</tbody>
[TD]
<colgroup><col width="99"></colgroup><tbody>
[TD="class: xl66, width: 99"]19.9[/TD]
</tbody>
[TD][/TD]
[/TR]
</tbody>[/TABLE]
This particular dataset has 228,000 rows, and while almost all of the time intervals are between 5 minutes exactly, and 5.0333 minutes, there are instances of data-gaps, ranging from one timestamp missing, up to 7 days of data missing (= 2,000 records missing - I use the comma separator as a thousand separator). Also, there may be instances, where an hour of data may take 13 records, instead of 12, due to the slightly irregular time interval gaps. In the Table above, the 3rd column contains the average of the previous 12 records. My goal is to ascertain whether hourly records would be sufficient, since the values in the second column seem to change so little. It looks like I will also need the Max and Min values from each hour: crikey, it does look complex. Using MS Excel 2010, and Windows 7 Professional.
I am not experienced in VBA, although I have tinkered with it in the past. Any ideas?
(I can use Formulas, such as Countifs, Sumifs etc. and also Named ranges)