Help with formula - rolling average

BPS

New Member
Joined
Nov 23, 2009
Messages
13
Hi -
I am hoping someone can help me with a formula.

In the spreadsheet below, in column A is the Date and Time (going up in 15 min intervals). Column B is a flow rate at that corresponding Date/Time.

I have added another column (column C) which calculates the rolling hourly average of column B. For each 24hr period I need to return the lowest of the Rolling Average values between the hours 00:00 - 06:00. I have calculated this manually (highlighted yellow) for the purpose of showing what the correct result is.

I need to apply this formula to alot of data (>100,000 rows). Please let me know if I have missed any crucial info!

1ABCD
2Date TimeFlow (l/s)Rolling Average (l/s)MNF (l/s)
31/01/2012 00:000.302
41/01/2012 00:150.229
51/01/2012 00:300.037
61/01/2012 00:450.2010.192
71/01/2012 01:000.1460.153
81/01/2012 01:150.3390.181
91/01/2012 01:300.3430.257
101/01/2012 01:450.2610.272
111/01/2012 02:000.1740.279
121/01/2012 02:150.1460.231
131/01/2012 02:300.0460.157
141/01/2012 02:450.0050.093
151/01/2012 03:000.0550.063
161/01/2012 03:150.1740.070
171/01/2012 03:300.0180.063
181/01/2012 03:450.1370.096
191/01/2012 04:000.3430.168
201/01/2012 04:150.3480.211
211/01/2012 04:300.0920.230
221/01/2012 04:450.2010.246
231/01/2012 05:000.2200.215
241/01/2012 05:150.1050.155
251/01/2012 05:300.0180.136
261/01/2012 05:450.0370.095
271/01/2012 06:00 0.0530.053
281/01/2012 06:150.0410.032
291/01/2012 06:300.0090.029
301/01/2012 06:450.0410.030
311/01/2012 07:000.0370.032
321/01/2012 07:15 0.029
331/01/2012 07:300.5130.197
341/01/2012 07:450.0550.202
351/01/2012 08:000.3340.301
361/01/2012 08:150.0550.239
371/01/2012 08:300.2240.167
381/01/2012 08:450.6130.306
391/01/2012 09:000.2330.281
401/01/2012 09:150.0690.285
411/01/2012 09:300.5310.361
421/01/2012 09:450.6590.373
431/01/2012 10:000.7780.509
441/01/2012 10:151.0120.745
451/01/2012 10:300.6640.778
461/01/2012 10:450.5490.751
471/01/2012 11:000.8610.771
481/01/2012 11:150.5490.656
491/01/2012 11:300.2840.561
501/01/2012 11:450.7830.619
511/01/2012 12:001.2590.719
521/01/2012 12:151.1540.870
531/01/2012 12:301.1171.078
541/01/2012 12:450.6001.032
551/01/2012 13:000.8420.928
561/01/2012 13:150.9800.885
571/01/2012 13:300.3480.693
581/01/2012 13:450.5680.685
591/01/2012 14:000.2660.541
601/01/2012 14:150.3070.372
611/01/2012 14:300.4300.393
621/01/2012 14:450.0920.274
631/01/2012 15:000.3020.283
641/01/2012 15:150.2470.268
651/01/2012 15:300.4670.277
661/01/2012 15:450.4210.359
671/01/2012 16:000.5860.430
681/01/2012 16:150.4670.485
691/01/2012 16:300.1970.418
701/01/2012 16:450.4720.431
711/01/2012 17:000.1190.314
721/01/2012 17:150.4760.316
731/01/2012 17:300.0550.281
741/01/2012 17:450.1510.200
751/01/2012 18:000.4620.286
761/01/2012 18:150.0460.179
771/01/2012 18:300.4900.287
781/01/2012 18:450.4070.351
791/01/2012 19:000.3940.334
801/01/2012 19:150.4760.442
811/01/2012 19:300.4760.438
821/01/2012 19:450.3480.424
831/01/2012 20:000.5770.469
841/01/2012 20:150.2520.413
851/01/2012 20:301.1900.592
861/01/2012 20:450.6180.659
871/01/2012 21:000.1830.561
881/01/2012 21:150.5310.631
891/01/2012 21:300.4900.455
901/01/2012 21:450.6000.451
911/01/2012 22:000.3300.488
921/01/2012 22:150.4850.476
931/01/2012 22:300.2060.405
941/01/2012 22:450.0320.263
951/01/2012 23:000.4760.300
961/01/2012 23:15 0.238
971/01/2012 23:300.1190.209
981/01/2012 23:450.3480.314

<COLGROUP><COL style="WIDTH: 22pt; mso-width-source: userset; mso-width-alt: 1060" width=29><COL style="WIDTH: 90pt; mso-width-source: userset; mso-width-alt: 4388" width=120><COL style="WIDTH: 71pt; mso-width-source: userset; mso-width-alt: 3474" width=95><COL style="WIDTH: 101pt; mso-width-source: userset; mso-width-alt: 4937" width=135><COL style="WIDTH: 71pt; mso-width-source: userset; mso-width-alt: 3474" width=95><TBODY>
</TBODY>
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Perhaps I didn't explain it very well. I have many days which I need to calculate the min rolling average for (between 00:00-06:00), so there will be a different min value for each day of the week.
 
Upvote 0
=IF(HOUR(A27)=6,MIN(C3:C27),"")

If all your data is in one column, you can fill down with that formula and you will only see the minimum value from the desired timeframe. The rest will appear as blank cells.
 
Upvote 0
Hi - the minimum rolling average value could occur at any time of the day - its not a fixed time range and it could be different every day, in the attached example the lowest value was the average of B23:B26. Even though the lowest could occur at any time of the day I am only concerned with the lowest average between these 00:00 - 06:00.

The formula needs to look at any of the average values between XX/XX/XXXX 00:00 and XX/XX/XXXX 06:00 and return the lowest.
 
Upvote 0
I don't see the problem with my most recent formula. Is it not working? It was designed so that you could use the "fill down" command to copy it to all the cells below it and it will still work.

Here is how it works:
1. The IF() portion of the formula makes it so the desired value only appears next to those cells that represent 6 AM.
2. The MIN(C3:C27) portion pulls the minimum value from a 6-hour time frame. When you fill down, this range of cells will change. So cell D27 has MIN(C3:C27), but cell D28 will have MIN(C4:C28). It always pulls the lowest value in the averages column for the past 6 hours.

This means that it will pull the value you are looking for and put it next to the entry for 06:00 AM. I'm assuming you're saying it's wrong because it doesn't pop up next to the minimum value itself. I don't know how to do that, but this formula will work as a substitute until you can figure out the ideal solution.
 
Upvote 0

Forum statistics

Threads
1,221,828
Messages
6,162,215
Members
451,752
Latest member
freddocp

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