AmeliaBedelia
New Member
- Joined
- Apr 8, 2018
- Messages
- 19
I have hit a wall with how to create an average of only the last X number of data in a column. Most of the answers I have found online for this have formulas that either do not work or I am not able to understand what needs to be amended to fit my situation.
My spreadsheet is as follows:
Column A Column B
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD](Want Average to posted here
as data is added to this column)[/TD]
[TD](Want the date where there
is a minimum of 5 and an 80%
average to be posted here)[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Results[/TD]
[TD]Date[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 3 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 4 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 5 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 5 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 6 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 7 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 7 2018[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
First I need to calculate the average for the Results column, but only for the last 5 results. The results and date columns will be dynamic as data will constantly be added to these columns, so I need it to constantly look for the last row and only use the last 5. Results will only either be a 1 (100%) or a 0 (0%). There will be no empty rows. I was hoping that the average could be placed in a cell above the heading "Results", but due to some formulas I have tried, this sometimes creates a circular reference and may not be possible. So I do have flexibility that I can post the average in another column.
I want the average to post even if the minimum number is not reached, which is 5 in this case.
For example,
First Result:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]0%[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Results[/TD]
[TD]Date[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 3 2018[/TD]
[/TR]
</tbody>[/TABLE]
Second Result:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]0%[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Results[/TD]
[TD]Date[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 3 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 4 2018[/TD]
[/TR]
</tbody>[/TABLE]
Third Result:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]33%[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Results[/TD]
[TD]Date[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 3 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 4 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 5 2018[/TD]
[/TR]
</tbody>[/TABLE]
Fourth Result:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]50%[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Results[/TD]
[TD]Date[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 3 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 4 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 5 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 5 2018[/TD]
[/TR]
</tbody>[/TABLE]
Fifth result:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]60%[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Results[/TD]
[TD]Date[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 3 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 4 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 5 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 5 2018[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 6 2018[/TD]
[/TR]
</tbody>[/TABLE]
Sixth Result:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]60%[/TD]
[TD](Want Date hit 80% here)[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Results[/TD]
[TD]Date[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 3 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 4 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 5 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 5 2018[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 6 2018[/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 7 2018[/TD]
[/TR]
</tbody>[/TABLE]
Once there are a minimum of 5 results and it reaches an average of 80% I want the date next to the result that created the 80% to be posted into the cell above the Date heading.
So in this example, since the minimum # we want is 5, it is only after the 7th result where there is a minimum of 5 results and the average has reached an 80%, so I want the date to be posted above the Date heading:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]80%[/TD]
[TD]June 7 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Results[/TD]
[TD]Date[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 3 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 4 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 5 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 5 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 6 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 7 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 7 2018[/TD]
[/TR]
</tbody>[/TABLE]
Thanks
My spreadsheet is as follows:
Column A Column B
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD](Want Average to posted here
as data is added to this column)[/TD]
[TD](Want the date where there
is a minimum of 5 and an 80%
average to be posted here)[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Results[/TD]
[TD]Date[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 3 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 4 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 5 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 5 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 6 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 7 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 7 2018[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
First I need to calculate the average for the Results column, but only for the last 5 results. The results and date columns will be dynamic as data will constantly be added to these columns, so I need it to constantly look for the last row and only use the last 5. Results will only either be a 1 (100%) or a 0 (0%). There will be no empty rows. I was hoping that the average could be placed in a cell above the heading "Results", but due to some formulas I have tried, this sometimes creates a circular reference and may not be possible. So I do have flexibility that I can post the average in another column.
I want the average to post even if the minimum number is not reached, which is 5 in this case.
For example,
First Result:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]0%[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Results[/TD]
[TD]Date[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 3 2018[/TD]
[/TR]
</tbody>[/TABLE]
Second Result:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]0%[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Results[/TD]
[TD]Date[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 3 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 4 2018[/TD]
[/TR]
</tbody>[/TABLE]
Third Result:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]33%[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Results[/TD]
[TD]Date[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 3 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 4 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 5 2018[/TD]
[/TR]
</tbody>[/TABLE]
Fourth Result:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]50%[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Results[/TD]
[TD]Date[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 3 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 4 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 5 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 5 2018[/TD]
[/TR]
</tbody>[/TABLE]
Fifth result:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]60%[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Results[/TD]
[TD]Date[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 3 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 4 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 5 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 5 2018[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 6 2018[/TD]
[/TR]
</tbody>[/TABLE]
Sixth Result:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]60%[/TD]
[TD](Want Date hit 80% here)[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Results[/TD]
[TD]Date[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 3 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 4 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 5 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 5 2018[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 6 2018[/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 7 2018[/TD]
[/TR]
</tbody>[/TABLE]
Once there are a minimum of 5 results and it reaches an average of 80% I want the date next to the result that created the 80% to be posted into the cell above the Date heading.
So in this example, since the minimum # we want is 5, it is only after the 7th result where there is a minimum of 5 results and the average has reached an 80%, so I want the date to be posted above the Date heading:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]80%[/TD]
[TD]June 7 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Results[/TD]
[TD]Date[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 3 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 4 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 5 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 5 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 6 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]June 7 2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]June 7 2018[/TD]
[/TR]
</tbody>[/TABLE]
Thanks