Hello,

I would use a Pivot Table.

For example select cell D1 Go to the Insert tab and click Pivot Table.

Select your range Sheet1!$A$1:$B$9 and click OK.
Then in the right hand pane, pull column A into the Row labels section and the B column in to the Values section.

Click on the Sum of B in the Values section and select Value Field Settings then Average.

I hope this helps.

Cheers,
Diana