Microsoft Office Tutorials and References
In Depth Information
Returning the Last Nonblank Cell in a Column or Row
Returning the Last Nonblank
Cell in a Column or Row
Suppose that you update a worksheet frequently by adding new data to its columns. You might
need a way to reference the last value in a particular column (the value most recently entered).
Figure 114-1 shows an example. The worksheet tracks the value of three funds in columns B:D.
Notice that the information does not arrive at the same time. The goal is to get the sum of the
most recent data for each fund. These values are calculated in the range G4:G6.
Figure 114-1: Use a formula to return the last nonempty cell in columns B:D.
The formulas in G4, G5, and G6 are as follows:
These formulas use the COUNTA function to count the number of nonempty cells in column C.
This value is used as the second argument for the INDEX function. For example, in column B the
last value is in row 6, COUNTA returns 6, and the INDEX function returns the 6th value in the
The preceding formulas work in most, but not all, situations. If the column has one or more empty
cells interspersed, determining the last nonblank cell is a bit more challenging because the
COUNTA function doesn’t count the empty cells.
The following array formula returns the contents of the last nonempty cell in the first 500 rows of
column C, even if column C contains blank cells: