Hi, welcome to the forum

This can be done, but I have a feeling you need to take a look at the AVERAGEIF() function instead?

If you still have a problem, upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.