To grab the latest entry in a column — the most recent reading, the last filled cell — or the first one, you need a formula that skips blanks. The classic LOOKUP(2,1/…) trick nails the last value; XLOOKUP does it cleanly in modern Excel.
The example
A reading column with gaps. We want the last reading.
| A | B | |
|---|---|---|
| 1 | Reading | |
| 2 | 12.1 | |
| 3 | ||
| 4 | 12.8 | |
| 5 | ||
| 6 | Last reading: | 12.8 |
The formula
The most recent reading:
How it works
The LOOKUP(2, 1/…) trick is the workhorse:
A2:A5<>""builds a TRUE/FALSE array of “has a value.”- Dividing
1by it gives1for filled cells and#DIV/0!for blanks. - LOOKUP searches for
2— which never exists — so it walks to the last non-error value, i.e. the last filled cell:12.8. - For the first non-blank instead, use INDEX/MATCH or XLOOKUP (see variations).
Modern and readable: last non-blank = =XLOOKUP(TRUE, A2:A100<>"", A2:A100, , 0, -1) (searches bottom-up). First non-blank = the same with search_mode 1.
Try it: interactive demo
Type a list with blanks (empty commas); see the first and last non-blank.
Variations
First non-blank (INDEX/MATCH)
Find the first cell that isn’t empty:
Last non-blank with XLOOKUP
Search from the bottom up:
Last number only
Ignore text cells too:
Pitfalls & errors
Formulas returning "" count as non-blank to <>""? No — <>"" treats an empty string as blank, which is usually what you want. Use ISBLANK logic if you need the strict difference.
The LOOKUP trick looks weird but is robust. Searching for 2 in an array of 1s and errors reliably returns the last 1.
XLOOKUP/array versions need 365 or CSE. The A2:A100<>"" array works natively in 365; older Excel may need Ctrl+Shift+Enter for the INDEX/MATCH form.
Practice workbook
Frequently asked questions
How do I get the last non-blank value in a column in Excel?
How do I get the first non-blank value?
How does LOOKUP(2,1/(range<>"")) work?
Stop fighting formulas. Learn them in a day.
This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.
See the Formulas & Functions Class