Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, and 2016. 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: Referring to the Last Cell.

Referring to the Last Cell

Written by Allen Wyatt (last updated September 27, 2021)
This tip applies to Excel 2007, 2010, 2013, and 2016


There may be times when you are putting together a workbook and you want to keep a summary on one worksheet and detail information on another. For instance, let's suppose Sheet1 is your summary worksheet, and you have detailed information for bank accounts on Sheet2. In looking at the detail information, you have dates in column A, and balances for different accounts in columns B, C, and D. Thus, the detailed information is a table that shows a running progression of bank balances on different dates.

In putting together your summary information on Sheet1, you realize that you need to reference the last figures in columns B, C, and D. These figures represent the latest balances, and thus are perfect for your summary. How do you do it? Particularly when you continue to add information to your detail worksheet over time?

Actually, there are several ways to approach the problem. (There are typically several ways to solve any Excel problem.) One way is to use the VLOOKUP function. At the point in the summary where you want the latest balance from column B of the detail (Sheet2), you would put the following formula:


To change references for the other two account balances, you would simply change the last number (2) to either 3 (for the account in column C) or 4 (for the account in column D). The function works because it looks up the maximum value in column A, which contains dates. It then looks in the data table (Sheet2!$A:$D) and finds the appropriate offset for the desired column.

This approach works fine, provided there are no dates in column A past the last balances entered. If there are, then the values returned will always be incorrect.

Another way to approach the problem is to use the INDEX function in conjunction with either COUNT or COUNTA. If the detail columns don't contain any text (even in the column headers), then you would use the COUNT function. If there is text included, then COUNTA is preferred. At the point where you want to include the last balance from column B of the detail, you would use the following formula:


It looks into the table, determines the number of non-blank cells in column B, and then pulls the figure from that last non-blank cell. To adapt the formula for columns C and D, simply change the B references to the appropriate C or D.

Still another way to deal with the problem is to use the OFFSET function, as in the following:


This function returns the value of a cell offset from a base reference cell. In this case, the base cell is Sheet2!B1. The COUNTA function is used to determine how many rows to offset from the base, and the 0 specifies that the offset should be in the same column as the base reference. To change the formula for columns C and D, simply change all references to B to either C or D.

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

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


Viewing Comments

Adding comments to a document is a normal activity when writing and editing. Once comments have been added, you may ...

Discover More

Make AutoCorrect Pay Attention to Character Case

If you rely on AutoCorrect (as most Word users do), you may have noticed that it doesn't always give the desired results ...

Discover More

Synchronizing Lists

Two lists of similar data can be challenging to synchronize. Here are some ways that you can align data in two different ...

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)

Counting Wins and Losses

Need to count the number of W (win) or L (loss) characters in a range of cells? You can develop a number of formulaic ...

Discover More

Formatting Canadian Postal Codes

Postal codes in Canada consist of six characters, separated into two groups. This tip explains the format and then shows ...

Discover More

Incrementing References by Multiples when Copying Formulas

You can easily set up a formula to perform some calculation on a range of cells. When you copy that formula, the copied ...

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 9 - 3?

2020-10-17 22:57:37


Regarding Ken Kast's post, I must say I usually will NOT go to the "" website, basically for any reason other than mistake.

The reason is that it make incredibly massive use of memory. Usually I would be using IE and going to a single page yanks me from, maybe, 150MB up to 1,100MB immediately. Open another page? Add 150-250MB each. That pretty much kills IE fairly immediately so... Decided to test it with Edge because of Mr. Kast's post and it yanked Edge right up to 1,105MB the instant it opened.

It's like every 3-letter government agency has added code to that site... or something... seriously, it has to be massive ads running massive scripts and such, and you know a massive number of ads accessing, not even putting an ad up, just accessing your browser like that, one or more must be doing something horrible.

So, never going there for any reason on God's Green Earth again. I had great hopes it was just some IE thing, maybe the first good reason I'd ever heard for stopping use of IE but noooo... NOT an IE thing at all. So... and it's a shame. The guy seems to have plenty, and I do mean plenty, of good stuff. Shame. Must be very dollarizing, but I won't ever go again after tonight.

The point of the website's content in this case is to use the following, or a variant that fits your circumstance:


I modified for adding 1 to it and also to limit the ranges, so not A:A but rather A1:A12000. The lag was tremendous with A:A. But the other thing it does is my old OFFSET() used a COUNTA() in it and if our data included any random empty cell in the column being ckecked, well... too bad.

It would also be easy to modify for starting somewhere other than first row, and so on. I fed it into an ADDRESS() function since my need is for an address, but it would have lots of other uses. Say, this minus COUNTA() would tell you if ou have empty cells in a given column or row. I bet there's a hundred other ways it would be useful.

2017-12-09 18:14:58

Ken Kast

These formulae are pretty opaque. If one is auditing a workbook it would probably take some time to figure out what is going on here. Besides that I do not think the solutions relying on COUNTA work in all cases. In particular, if there is a blank is a cell, then COUNTA will not point to the last row; it points to the row number corresponding to the number of non blanks. As an example, if the data set looks like


COUNTA is 4 but the last row is 6.

This site has a solution which accounts for "strange" cells:

2017-12-09 06:55:01

Mike Hodkinson

Excellent item on referring to the last cell. Took this one stage further and what if you needed to find the address of the last cell in a column by formula. Found =ADDRESS(COUNTA(Sheet1!B:B),COLUMNS(2)) does this for you. Hope this is of interest.

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.