Try this array formula**:
=AVERAGE(IF(SUBTOTAL(2,OFFSET(A5,ROW(A5:A100)-ROW(A5),0,1))>0,A5:A100))
** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.
Adjust the range to suit.