Skip to content

How to get the last value in a column in Excel in Excel

Return the last non-blank value in a column with LOOKUP, XLOOKUP searching from the bottom, or INDEX, so the result updates when you add rows.

A log grows by a row every day and you want a cell that always shows the latest entry, the closing balance or the most recent reading, without editing the formula each time.

The idea is to find the position of the last filled cell, then return the value at that position. The shortest formula that does it in one step is:

=LOOKUP(2, 1/(B2:B15<>""), B2:B15)

B2:B15<>"" tests every cell and returns TRUE for the non-blank ones. Dividing 1 by TRUE/FALSE gives 1 for filled cells and #DIV/0! for blanks. LOOKUP is searching for 2, which is bigger than anything in the list, so it settles on the last number it can see, the last filled position. It ignores the errors. Then it returns the matching item from the third argument. It is a well-known trick, and it works in every version.

XLOOKUP expresses the same idea more clearly by searching from the bottom: =XLOOKUP(TRUE, B2:B15<>"", B2:B15, , 0, -1). The last argument, -1, means search from last to first.

INDEX(B2:B15, COUNT(B2:B15)) also works, but only when the data is contiguous, with no gaps, because it assumes the last value sits at position COUNT.

Choose a range that reaches past your data, to row 15 here, so new rows are picked up. If you point at a whole column such as B:B, make sure the heading is text and any totals below are not in that column.

For a quick manual jump, select a cell in the column and press Ctrl+Down Arrow to move to the last cell in the block. The formulas above are for cells that must update by themselves. The Lookups track covers more lookup patterns.

3 ways to do it

1LOOKUP(2, 1/(...))

=LOOKUP(2,1/(B2:B15<>""),B2:B15)

  1. Type =LOOKUP(2,1/(B2:B15<>""),B2:B15) in an empty cell.
  2. Make the range reach past the last row you expect to use.

2XLOOKUP searching from the bottom

=XLOOKUP(TRUE,B2:B15<>"",B2:B15,,0,-1)

  1. Type =XLOOKUP(TRUE,B2:B15<>"",B2:B15,,0,-1).
  2. The first argument looks for TRUE, the test marks filled cells, and -1 as the last argument searches from the end.

3INDEX with COUNT (no gaps)

=INDEX(B2:B15,COUNT(B2:B15))

  1. Type =INDEX(B2:B15,COUNT(B2:B15)). COUNT returns how many numbers there are, and INDEX returns the item at that position.
  2. Use this only when the filled cells run without blank rows in between.

Try it yourself

Solve it in the sheet. Every answer is checked, with hints if you need them.

Task 1 of 2

In D2, return the last balance entered in B2:B15. Rows 10 to 15 are still empty, and the formula must pick up new entries.

Answer in D2.

D2
A
B
C
D
E
F
1
Date
Balance
Latest balance
Latest date
2
03-Mar-2025
5,200
3
04-Mar-2025
5,640
4
05-Mar-2025
5,310
5
06-Mar-2025
6,080
6
07-Mar-2025
5,925
7
10-Mar-2025
6,410
8
11-Mar-2025
6,275
9
12-Mar-2025
6,190
10
13-Mar-2025
11
14-Mar-2025
12
17-Mar-2025
13
18-Mar-2025
14
19-Mar-2025
15
20-Mar-2025

Learn it properly, one graded sheet at a time.

Excel foundations covers this in lesson 7, COUNT and COUNTA.