average metric using multiple criteria in one range

I have a sheet with risk scores for various projects. A project may have multiple risks in the sheet, with a project number that relates to another sheet.

I want to create a metric that will show the average risk score for "project 1", "project 3", "project 4", "project 7" to use a simplistic example.

I have been experimenting with some suggestions I have seen for average formulas but nothing for this specific example of multiple criteria from one range.

Could someone help with this?