Please Note: This article is written for users of the following Microsoft Excel versions: 2007 and 2010. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Referencing the Last Cell in a Column.

Referencing the Last Cell in a Column

Written by Allen Wyatt (last updated January 22, 2024)
This tip applies to Excel 2007 and 2010


Patty asked about a common scenario, in which column B contains quite a bit of data, and information can be added to the cells in the column at any time. In a formula in cell C4, Patty wants to see the value at the bottom of those cells in column B that contain values. Thus, if cells B1:B27 contain data, then in cell C4 Patty wants to see the value that is in cell B27. If three more pieces of data are added to column B, then the value in C4 should contain the value in B30.

The solution to this problem depends on whether you can count on the data in column B containing blank cells or not. If the data is contiguous—it doesn't contain any blank cells—then you can use the following formula in C4:


This constructs an address based on the last cell in the column, and then uses the INDIRECT function to return the value at that address.

If it is possible for there to be blanks in column B, then the following formula will work:


Again, the INDIRECT function is used to fetch the actual value, but the address used by INDIRECT is put together differently.

A different approach is to use the VLOOKUP function to return the value. If column B consists of numeric values, then the following formula in C4 will work just fine:


If column B contains text, then the numeric lookup won't work, but the following will:


ExcelTips is your source for cost-effective Microsoft Excel training. This tip (11030) applies to Microsoft Excel 2007 and 2010. You can find a version of this tip for the older menu interface of Excel here: Referencing the Last Cell in a Column.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...


Formatting E-mail using AutoFormat

If you copy the text of an e-mail message to a Word document, you may notice that the formatting of the text leaves a lot ...

Discover More

Selecting Random Names

Got a tone of names from which you need to select a few random names? There are several ways you can extract what you ...

Discover More

Creating a Photo Catalog from a Folder of Photos

Excel is great for collecting all sorts of information. You might even use it to create a catalog of your photos. Working ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (ribbon)

Pasting Excel Data within Word's Page Margins

The programs in the Microsoft Office suite are designed to work with each other easily. Sometimes there can be hiccups ...

Discover More

Checking for a Value in a Cell

Need to figure out if a cell contains a number so that your formula makes sense? (Perhaps it would return an error if the ...

Discover More

Combining Multiple Rows in a Column

Do you need to concatenate the contents of a range of cells in the same column? Here's a formula and a handy macro to ...

Discover More

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is nine minus 3?

2021-09-22 11:51:10


I'm using =INDIRECT("B"&COUNTA(B:B)) but it's returning a cell in the middle of the column. There are no blanks but some cells within the column has basic =SUM formulas. Can someone please assist?

2015-12-30 06:05:12


NOTE: The formulas using the MAX function are "array" formulas and therefore need to be entered using the 'Ctrl+Shift+Enter" key combination for it to work correctly.

2015-07-21 09:47:29


I am using the Vlookup one with great success I just need to have it omit any cell with a (0) in it. any help would be great.

2015-04-16 11:40:54

Chuck Trese

There are many methods, each has it's pros and cons. Here is a fairly foolproof method, based on your question.

Range("A"& cells.Rows.Count).End(xlUp)

This method starts in column A, goes all the way to the bottom, then does the equivalent of Ctrl-UpArrow to find the last non-empty cell. The up-side to this one is that it looks for anything other than an empty cell. The down-side to this one is that if you have a formula in the cell that returns "", it can still give you that 'empty' cell, because this method does not consider a formula as empty.

2015-04-16 11:38:14


Your original method works fine, unless the target is on a remote worksheet. e.g.,
I have an existing formula:
=VLOOKUP(B143,'Daily >0 5-minute'!E$12252:G$18791,2,FALSE)
in which I would like to replace "18791" with the row of the current last cell. I can find that value easily with
=COUNTA('Daily >0 5-minute'!A:A)
but all my attempts to embed that formula in the VLOOKUP argument have resulted in a variety of errors.

2015-04-15 13:52:13

Scott Levy

How would you use this last cell in a column formula in a macro to set the name range from $A$1 to the "LAST CELL"

2015-02-01 08:34:10


Yep, it DOES help!

2015-01-31 13:30:57

Willy Vanhaelen

My version is 2007. I had the same problem with some array formulas in former versions. Try to restrict your range as for instance:


Perhaps that helps.

2015-01-31 08:24:03


Yes tour formula is very nice and concise, but... Before writing my formula, I did tried yours, but I did not succeed in getting it to work: it gives a #NUMBER error, seemingly from the A:A<>"" part(?)
Maybe we have different XL versions? Mine is 2003 SP3...

2015-01-30 13:39:45

Willy Vanhaelen

Why use so a lenghty formula when this very short one does the same job?


2015-01-30 11:52:57


A formula that works on the whole column, whether it contains only numbers, only characters or both, with or without blank cells:
=IF(ISNA(MATCH(9^15,B:B)),INDIRECT("B"&MATCH("*",B:B,-1)),IF(ISNA(MATCH("*",B:B,-1)),INDIRECT("B"&MATCH(9^15,B:B)), INDIRECT("B"&MAX(MATCH(9^15,B:B),MATCH("*",B:B,-1)))))
A bit lengthy, but thoroughly tested.
Hope this helps.

2015-01-28 07:28:15

Willy Vanhaelen

@ Alfred and Micky

Better even use A:A<>"" when you want a 0 value or a formula returning 0 to be included.

2015-01-27 14:27:04

Michael (Micky) Avidan

You will be better off with the use of: A:A<>0 especially in cases of a negative value.
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2015)

2015-01-27 12:26:57

Alfred Polan

This short formula will do the job of looking up the last item in a column rather than all of the fancy stuff. =LOOKUP(2,1/(A:A>0),A:A)

2015-01-27 09:55:47

Chuck Trese

I like that David - at least for cases where a table fits the need. Nice and simple.
Building off your idea, here's a generic form (won't break if you move your table).


2015-01-27 04:45:25

David Sheen

Why not just convert the column to a single column table. The formula =OFFSET($B$1,ROWS(table1),0) should always return the value in the last cell.

2015-01-26 09:30:28

Chuck Trese


Here's an array formula that works for any named range (assuming range is one column wide, of course). If you name your range MyRange, then the below array formula works:


Enter using Ctrl-Shift-Enter.

2015-01-26 09:07:53

Chuck Trese

Here is an improvement on the formula given in the tip (finding last item in all of column B):


Again, this is an array formula, so you must enter it by pressing Control-Shift-Enter.

2015-01-26 08:56:28

Chuck Trese

The given (corrected) formula:
only works as an array formula. This means you do not enter it by pressing Enter, you have to press Control-Shift-Enter (sometimes called CSE). When you do this correctly, Excel will put curly braces around the formula and it will give correct results.

Patrick, your formula is correct, but same problem. Enter using Control-Shift-Enter, all at the same time.

2014-11-21 13:06:44


Hi Allen or anyone that can help:

I used the following formula to find the last value in column G between rows 170 to 190 with some blank cells...


and I get the #VALUE! error message.

Thank you,


2014-11-17 15:35:46


This suggestion for included blank column
does not function for Excel 2010.
Would appreciate correction.

2014-10-04 11:49:02


Thanks, very much, I am saving lots of time here:


to get the average even when new data is added.

However this seems not to work in Graph data ranges! If I try to keep my charts updated in the same way, I get a Formula error every time. Do chart ranges work differently?



2014-10-01 17:16:39



The ADDRESS function returns a text-string of the address. In order for it to be used to return the value at that address it needs to be put inside the INDIRECT() function.


It's a beautiful thing! No more hard-coded Column letters.

I take it one more step. I name my columns, use the COLUMN() function and the ROW() function.

While I'm all excited about this, that COLUMN() function with NAMES is handy in VLOOKUP()'s for bullet proofing the value (first argument) and offset (third argument). It makes for long formulas but if someone inserts a column or deletes one there is no problem.

Let's say you've Named the following
- Column where Argument 1 values are: PartNumberCol
- Table where you are looking up the information (Argument 2): PartsLocationTable
- Column in PartsLocationTable where the information is that you need: PartsBinCol

Argument 1: INDIRECT(ADDRESS(ROW(),COLUMN(PartNumberCol))
Argument 2: PartsLocationTable
Argument 3: COLUMN(PartsBinCol) - COLUMN(PartsLocationTable) + 1

2014-09-29 16:36:50


Please no vba, just functions/formula.

I have data that I update daily by adding new rows. I want to use the new row number in other calculations

eg =COUNTIFS(L6:L56,"Won",J6:J56,">0")

If I add 3 rows of data L59 and J59 will become the new addresses in the formula above.

I tried it using

=COUNTA(A:A)+5 (in cell D2)

to get the number of used rows (adding a constant, known offset) and then use this in

=ADDRESS(D2,12)( in cell F2)

.. but this


does not work, nor does


How can I get a formula to use the address reference I found with the ADDRESS function?



2014-07-30 06:50:27


The second formula in this article is incorrect. "B1:1048576" is not a valid range. It's missing the column indicator after the colon.

Even when fixed this formula is returning the first value in column B, not the last, and results in a #REF! error when the first cell in the range is blank.

2013-12-31 06:18:06

Michael (Micky) Avidan

Try to learn all about the 'OFFSET' function.
In order to help you - please upload your workbook to one of many File Hosting sites and present the link to the file.
Please explain - in details - the requested results as per your file.
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2014)

2013-12-30 18:31:58


I need to make a list on a tab that is separate from my Data. I want the list to return column C info when Column H is empty.
But, I would like to look up the bottom 5 to 10 entries, so the first 5-10 empty cells in column H?

Could you help with this? Or is it possible with a formula?

This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.