in range A10:A20.

If empty cell present then take the last row number in range which is A20 and subtract with the row number where the empty cell is present. Output the resulting value in cell E1.

Note: If more than 1 empty cell in range A10:A20 then apply the formula to the first empty cell from the top.