PD in Waterloo
New Member
- Joined
- Feb 12, 2024
- Messages
- 7
- Office Version
- 365
- Platform
- Windows
I have an Excel 365 workbook with a data table on one tab and a results page on another tab. The data table contains a column with the results of hundreds of trials, each with a numerical trial score earned by the participant whose corresponding name is in the adjacent column. Each name is repeated hundreds of times. The data are currently sorted:
1. Participant names by alpha
2. Scores hi-low
There are other columns (date, trial_type, etc), immaterial for this project.
I want to craft a formula that returns the average of the top top n percent of trial scores for each person.
By way of example, if I just needed the average of each person's scores, I would use:
I was able to figure out a formula to capture the average of the top n count of each person's scores:
But I just can't suss out a formula to get the averages of only a subset each participant's scores, namely the top *n* percent of his or her scores (with the *n* value in a reference cell).
I thought about adding a column to the table to generate a "1" of "0" result based on whether the score in that row was in the top n percent of the person's scores, and then adding the "1" to the conditions of an AVERAGEIFS formula.
Seems kludgy in concept so any more elegant suggestions/ideas gratefully received!
1. Participant names by alpha
2. Scores hi-low
There are other columns (date, trial_type, etc), immaterial for this project.
I want to craft a formula that returns the average of the top top n percent of trial scores for each person.
By way of example, if I just needed the average of each person's scores, I would use:
Excel Formula:
AVERAGEIF(DATASET[name]:[name]],$A4,DATASET[TRIAL_SCORE]) // $a4 is the participant's name
I was able to figure out a formula to capture the average of the top n count of each person's scores:
Excel Formula:
=AVERAGEIFS(DATASET[[trial_score]:[trial_score]],DATASET[[name]:[name]],
$A4,DATASET[[trial_score]:[trial_score]],">="&LARGE(IF(DATASET[[name]:[name]]=$A4,
DATASET[[trial_score]:[trial_score]]),J$3)) // $A4 is the relative cell ref for the participant’s name; j$3 is the relative cell ref atop several columns with the desired count parameter
But I just can't suss out a formula to get the averages of only a subset each participant's scores, namely the top *n* percent of his or her scores (with the *n* value in a reference cell).
I thought about adding a column to the table to generate a "1" of "0" result based on whether the score in that row was in the top n percent of the person's scores, and then adding the "1" to the conditions of an AVERAGEIFS formula.
Seems kludgy in concept so any more elegant suggestions/ideas gratefully received!