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

by Allen Wyatt
(last updated January 26, 2015)


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. ...


Error Generated if Files Opened in Word Session

Greg has a problem with Word 2002 crashing, depending on how he opens files. This seems to be a problem that Microsoft knows ...

Discover More

Positioning a Graphic in a Macro

Macros are a great way to process information in a worksheet. Part of that processing may involve moving graphics around so ...

Discover More

Duplicating Drawing Objects

Need to duplicate a drawing object? It's easy to do if you use the same editing techniques you are already familiar with.

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Displaying Row and Column Labels

When you create a worksheet, it is common to place headings at the top of each column and the left of each row so you can ...

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

Highlighting the Rows of Selected Cells

If you lose your place on the screen quite often, you might find it helpful to have not just a single cell highlighted, but ...

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}] 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 8 - 3?

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.