Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rolling Average with Arrays > 1000

Status
Not open for further replies.

Clepol

Technical User
Oct 29, 2012
1
US
thread767-1487073

Hello,

I've been able to modify and use the rolling average code from the thread referenced above, but now I need it to be able to handle data sets that produce arrays greater than 1000 elements. I believe this can be done by creating multiple arrays as seen on page 10 in the following link ( but I'm having some trouble implementing this approach. Any and all help would be greatly appreciated. Below is the code I'm currently working with. Thanks.

numbervar the_field_NOx := {Sheet1.NOx};
numbervar array Accum_NOx;
numbervar Rolling_Period := 12;

if OnFirstRecord then
ReDim Accum_NOx [1]
else
ReDim Preserve Accum_NOx [UBound(Accum_NOx)+1];

Accum_NOx [UBound(Accum_NOx)] := the_field_NOx;

If UBound(Accum_NOx) <= Rolling_Period then
Sum(Accum_NOx)/12
Else
sum(Accum_NOx[(UBound(Accum_NOx) - (Rolling_Period-1)) to UBound(Accum_NOx)])/12;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top