If you have cells with something like =""
and don't want to count them, you have to subtract number of empty cells from total number of cell by formula like
=row(G101)-row(G4)+1-countblank(G4:G101)
In case of 2-dimensional array it would be
=(row(G101)-row(A4)+1)*(column(G101)-column(A4)+1)-countblank(A4:G101)
Tested at google docs.