The syntax of the AVERAGEIF function

=AVERAGEIF(range, criteria, [average_range])

range contains the cells that the function will apply the criteria to. If there’s no average_range argument, these numbers will also be used to calculate the average.

criteria is a logical statement (like “>4”) that determines which numbers are included in the average.

average_range is an optional argument; if it’s included, the function will draw the numbers for the average from this range.

https://spreadsheeto.com/averageif/#averageif is a good quick excel source.

HTH