=COUNTBLANK(E2:INDEX(E1:E1000,MATCH(2,1/(E1:E1000<>""))))
But now the formula needs to be entered with Ctrl + shift + enter. You also must not have entire column references like E:E.
EDIT:
This one:
=COUNTBLANK(E2:INDEX(E1:E1000,LOOKUP(2,1/(E1:E1000<>""),ROW(E1:E1000))))
needs just normal enter.