# Calculating multiple averages of periods indicated by increasing values

#### Keen_to_learnExcel

##### New Member
Hi all,

I have a problem, I want to calculate the mean of daily production over a period of time, but this period is very different per case. Below you can see one case, in reality the row is much longer but for practical reasons in shortened the different periods. The top row indicates the day in the period that the day-production is measured. All cases have a different number periods and the periods differ in length. It is also possible that the case only has one period. I added colours to indicate the different periods, these colours aren’t present in my excel file.

Now I’m looking for a formula that gives me the average of a period. An indicator of a period is that the row "Day" is increasing, when the period is over the value in row "Day" decreases to a low number. Can someone help me with a formula that automatically calculates the average of one period? So that the results look something like here below.

I tried to fix it myself but unfortunately I didn’t come close to a good solution. Any ideas how I can find a good solution are welcome.
Much thanks in advance.

### Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

#### DonkeyOte

##### MrExcel MVP
if the Day/KgM values were in B1:Q2 then, per XL2010, one option {a little brute force} might be:

B4: =AVERAGE(INDEX(\$2:\$2;AGGREGATE(15;6;COLUMN(\$B\$1:\$Q\$1)/((\$B\$1:\$Q\$1<\$A\$1:\$P\$1)+(\$A\$1:\$P\$1=""));ROWS(B\$4:B4))):INDEX(\$2:\$2;AGGREGATE(15;6;COLUMN(\$B\$1:\$Q\$1)/((\$B\$1:\$Q\$1>N(+\$C\$1:\$R\$1)));ROWS(B\$4:B4))))
copied down

the above would replicate your expected results

Replies
14
Views
146
Replies
28
Views
520
Replies
0
Views
178
Replies
3
Views
164
Replies
0
Views
110

1,130,172
Messages
5,640,583
Members
417,152
Latest member
DayTimeSeby

### 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?

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