Hello
In your example file,try:

=AVERAGEIF($B$5:$B$941,$G9,C$5:C$941)
Copied across from H9 and down to I10.

DBY