Here are some examples using SQL:
To find the average for Jim
(This includes all scores)
Code:
SELECT peoplescores.person, Sum(score)/Count(score) AS RequiredAverage
FROM peoplescores
WHERE (((peoplescores.[person])="Jim")
GROUP BY peoplescores.person;
This excludes the Max(score) that Jim had
Code:
SELECT peoplescores.person, Sum(score)/Count(score) AS RequiredAverage
FROM peoplescores
WHERE (((peoplescores.[person])="Jim") AND ((peoplescores.[score])<>(select max(score) from peoplescores where person = "JIM")))
GROUP BY peoplescores.person;
This excludes the Min(score) Jim had
Code:
SELECT peoplescores.person, Sum(score)/Count(score) AS RequiredAverage
FROM peoplescores
WHERE (((peoplescores.[person])="Jim") AND ((peoplescores.[score])<>(select min(score) from peoplescores where person = "JIM")))
GROUP BY peoplescores.person;
You have to replace the field and tables names with your own.
This was the table I used for test
ID |
person |
testdate |
score |
1 |
jim |
22/04/2016 |
78 |
2 |
tom |
22/04/2016 |
78 |
3 |
jim |
24/04/2016 |
59 |
4 |
jim |
28/04/2016 |
66 |
5 |
tom |
23/04/2016 |
98 |
6 |
tom |
29/04/2016 |
88 |