I'm trying to figure out the rest if this formula and have tried several things, without success.

=SUMPRODUCT(D:D,--ISNUMBER(MATCH(C:C,{"July","August","September"},0)))

The above function finds those cells in Column C with the texts "July", "August", "September" and sums the figures beside them in Column D. Now I need to finish the formula, dividing it by the total number of such occurrences to obtain an average figure. There are blank cells in this worksheet.

Can anybody help me? Thanks.