Stumped! Finding average after max?

Crazysgt

New Member
Joined
Mar 23, 2018
Messages
3
I am in the need of some help. What I have is a simple excel data set. 2 columns, Column A is Time of day in 24 hrs @ 15 min intervals, (A1:A96). Column B contains whole numbers, (4 digits with comma) that are entered at every corresponding 15 min interval in Column A. I am needing the Max of Column B, which is obviously easy. My issue is I am needing the average, starting from the Cell containing the Max and the next 7 consecutive cells. It doesn't matter to me if the formula needs to correspond with the Max, or if using the Time the Max is found and averaging the next 7-15 min cell data including the Max.

For hopefully some better insight:

What is happening is every 15 minutes, a reading is taken from a flow meter automatically via a program called XLR Reporter. The State Regulatory Agency over this program requires a 2 hour peak average for every 24 hrs, starting from the Max reading which is completely random, which totals 8 - 15 minute readings.

Any help on this is greatly appreciated!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Welcome to the MrExcel board!

A couple of questions:

1. What should happen if the maximum value happens to occur more than once in column B?

2. What should happen if the maximum value occurs within the last 7 entries in the column, meaning you don't have 8 to average?
 
Upvote 0
#1
There will only be one Max in column B. This spreadsheet prints daily, at 23:45 hrs, only contains data for that day (24 hrs)-24:00-23:45 noted as time in column A. While throughout that day I understand the max could possibly change throughout, but at the end of the day there will only be 1 Max reading.

#2
This one is a bit more tricky! I have seen this scenario pop up from time to time. Normally we would just find the Max for that day and go in reverse. This happens very rarely. So I'm not too bothered on that part.

Hope you can shed some light?

Thanks
 
Upvote 0
try this:
=AVERAGE((OFFSET(B1,MATCH(MAX(B1:B96),B1:B96,0)-1,0,8)))
 
Last edited:
Upvote 0
Another way (without OFFSET):

=AVERAGE(INDEX($B$1:$B$96,MATCH(MAX($B$1:$B$96),$B$1:$B$96,0)):
INDEX($B$1:$B$96,MATCH(MAX($B$1:$B$96),$B$1:$B$96,0)-6))

Markmzz
 
Upvote 0
It seems like this is a one-off formula so using the volatile function OFFSET shouldn't be a problem. However, if you did want to avoid it, I think Mark's formula needs a slight adjustment to
=AVERAGE(INDEX(B1:B96,MATCH(MAX(B1:B96),B1:B96,0)):INDEX(B1:B96,MATCH(MAX(B1:B96),B1:B96,0)+7))



Normally we would just find the Max for that day and go in reverse.
I'm not sure just what that means. For the following example, assuming 1199 is the max for the column, what cells should be averaged?


Book1
B
851097
861077
871127
881192
891022
901055
911087
921009
931116
941199
951040
961029
97
Av after max
 
Upvote 0
I think Mark's formula needs a slight adjustment to
=AVERAGE(INDEX(B1:B96,MATCH(MAX(B1:B96),B1:B96,0)):INDEX(B1:B96,MATCH(MAX(B1:B96),B1:B96,0)+7))

Hi Peter,

Sorry, I didn't understand what the user wanted.

Thanks again for helps with my suggestion.

Here are two suggestions for the user:

=AVERAGE(INDEX(B1:B96,MIN(MATCH(MAX(B1:B96),B1:B96,0),89)):
INDEX(B1:B96,
MIN(MATCH(MAX(B1:B96),B1:B96,0)+7,96)))

Or this small modification in Offthelip's formula:

=AVERAGE(OFFSET(B1,MIN(MATCH(MAX(B1:B96),B1:B96,0),89)-1,,8))

Markmzz
 
Upvote 0
Markmzz, i think that in the modification to my formula your red "min" should be a "max" otherwise it will always average the last 8 numbers. I an working on a tablet at the moment so i can't paste the formula
 
Upvote 0
Markmzz, i think that in the modification to my formula your red "min" should be a "max" otherwise it will always average the last 8 numbers. I an working on a tablet at the moment so i can't paste the formula

Hi Offthelip,

Maybe I'm wrong, but look at this:

ABCDEFGHIJ
100:005360Max9999
200:155213
8521:007782
8621:159778AverageFormula01:5715,75
8721:303626Formula02:5715,75
8821:457779
8922:00438489
9022:158592
9122:303911
9222:45999992
9323:009839
9423:151005
9523:301109
9623:456887
******************************************************************

<tbody>
</tbody>

The Max between 89 e 92 is 92 and the Min between 89 e 92 is 89. Think about. You have 7 values after 92?

My suggestion to the user, in this case, is to calc the average of the last 8 numbers.

Markmzz
 
Upvote 0
No , you are correct, it should be the minimum of the match and 89!!
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,369
Members
449,080
Latest member
Armadillos

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