Google-sheets – How to select all cells between two cells, where more may be inserted later

google sheets

I am trying to count all the cells that have information between two cells that are in the same column.

This is easy enough to do using =countif(cell1:cell2, "<>") the problem is that I may need to update the cells at some point and insert new cells between cell1 and cell2, in which case this new cell will not be counted.

Is there anything I can do other than manually updating the formula every time?

Best Answer

As Rubén hinted in a comment, the cell range reference cell1:cell2 will be automatically updated if you insert or delete cells within the range. For example: if you have a formula

=countif(A2:A10, "<>")

and insert a row between 2nd and 10th, the command will automatically change to

=countif(A2:A11, "<>")