=AVERAGEIFS(B5:B14, A5:A14, ">="&D2, A5:A14, "<="&E2)
Like that?

I don't understand what the criteria for it being a weighted average instead just the mean is.