Loading

Got a version of Excel that uses the
menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)?
**This site is for you!** If you
use a later version of Excel, visit
our *ExcelTips* site focusing on the ribbon interface.

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.

Learn more about Allen...

ExcelTips FAQ

Ask an Excel Question

Make a Comment

Free Business Forms

Free Calendars

** Please Note:** This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later),

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:

=INDIRECT("B"&COUNTA(B:B))

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:

=INDIRECT("B"&MAX(ROW(1:65535)*(B1:B65535<>"")))

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:

=VLOOKUP(9.99999999999999E+307,B:B,1)

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

=VLOOKUP(REPT("z",50),B:B,1)

*ExcelTips* is your source for cost-effective Microsoft Excel training. This tip (2103) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Referencing the Last Cell in a Column.

*Related Tips:*

**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!

I have a ledger sheet like bellow:

Date Dr. Cr. Balance

1/1/14 5000 --- 5000

2/1/14 ---- 500 4500

3/1/14 ---- 400 4000

4/1/14 1000 ---- 5000

5/1/14 ---- 100 4900

6/1/14 ---- 200 4700

7/1/14 ---- 700 4000

I need to know how long this current balance is carrying. It clear it from 3/1/14 to 7/1/14. How i calculate by one formula in excel.

Date Dr. Cr. Balance

1/1/14 5000 --- 5000

2/1/14 ---- 500 4500

3/1/14 ---- 400 4000

4/1/14 1000 ---- 5000

5/1/14 ---- 100 4900

6/1/14 ---- 200 4700

7/1/14 ---- 700 4000

I need to know how long this current balance is carrying. It clear it from 3/1/14 to 7/1/14. How i calculate by one formula in excel.

@Phil,

Assuming you are entring transaction information (date type/reference, amount) in columns A, B, and C, and that your running balance is in column D then the formula would be:

=INDIRECT("D"&COUNTA(C:C))

You can change the "D" to any column you like and it will return the corresponding value.

NB the caveats re blanks cells is still applicable as noted in the Tip.

Assuming you are entring transaction information (date type/reference, amount) in columns A, B, and C, and that your running balance is in column D then the formula would be:

=INDIRECT("D"&COUNTA(C:C))

You can change the "D" to any column you like and it will return the corresponding value.

NB the caveats re blanks cells is still applicable as noted in the Tip.

This formula worked in finding the returning the value of the last row with number, but what should I do if I want to return the first row with data considering that some rows do not contain numbers.

=VLOOKUP(REPT("z",50),B:B,1)

=VLOOKUP(REPT("z",50),B:B,1)

I have a check book balance sheet sort of thing made for a client.

He wants each month in a different tab.. so I need to carry over the last balance calculated… to the top of the next page automatically. So I want the last value output in the balance column.

Imagine a check book.. per row you have + or - and the calculated current balance.

Each month will obviously have a different # of entries, so I want to reference the last balance value in the series.

Here is the kicker.. and why I can't seem to get any of these suggestions to work.. I think.

The column that holds the values I want to reference, is filled with a formula that calculates that balance.

So I am not referencing a number… I am referencing a column of cells that contain formulas that either spits out a number, or a "" to stay hidden and not spit out those IRRITATING… "#VALUE!"s and such.

Thus.. each cell is a (=IF) that calculates the - & + on that row entry, if there is one.

Example.. in M10

=IF(B10="","",M9-(H10+I10+J10)+K10)

Logically I see it as.. Check if (B10) is blank (""), TRUE display nothing (""), FALSE.. then take the previous value (M9) and subtract possible costs (H10+I10+J10) and add any possible deposits (K10).

This formula repeats per line down the page waiting to be used.. or not.

I need a formula that will look at this column of formulas that either give "" or a # and get the last # in that series.

I am looking to display it on the current page at the bottom first… so getting it to the next page is easy and not my concern.

My concern is that all the suggestions I have found spit out "#VALUE!" or gives an error.

I have made a lot of complicated spreadsheets, but haven't really gotten into combining formulas or adding extra symbols to them to bend excel to my will. So I keep failing here. PLEASE HELP!

He wants each month in a different tab.. so I need to carry over the last balance calculated… to the top of the next page automatically. So I want the last value output in the balance column.

Imagine a check book.. per row you have + or - and the calculated current balance.

Each month will obviously have a different # of entries, so I want to reference the last balance value in the series.

Here is the kicker.. and why I can't seem to get any of these suggestions to work.. I think.

The column that holds the values I want to reference, is filled with a formula that calculates that balance.

So I am not referencing a number… I am referencing a column of cells that contain formulas that either spits out a number, or a "" to stay hidden and not spit out those IRRITATING… "#VALUE!"s and such.

Thus.. each cell is a (=IF) that calculates the - & + on that row entry, if there is one.

Example.. in M10

=IF(B10="","",M9-(H10+I10+J10)+K10)

Logically I see it as.. Check if (B10) is blank (""), TRUE display nothing (""), FALSE.. then take the previous value (M9) and subtract possible costs (H10+I10+J10) and add any possible deposits (K10).

This formula repeats per line down the page waiting to be used.. or not.

I need a formula that will look at this column of formulas that either give "" or a # and get the last # in that series.

I am looking to display it on the current page at the bottom first… so getting it to the next page is easy and not my concern.

My concern is that all the suggestions I have found spit out "#VALUE!" or gives an error.

I have made a lot of complicated spreadsheets, but haven't really gotten into combining formulas or adding extra symbols to them to bend excel to my will. So I keep failing here. PLEASE HELP!

To find the last row that holds an AlphaNumeric value - you can use:

=MATCH("*",$A:$A,-1)

In order to return the last cells row in a Mixed column INCLUDING EMPTY(!) cells - use:

=MAX(MATCH(9^15,A:A),MATCH(CHAR(255),A:A,1))

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2014)

ISRAEL

=MATCH("*",$A:$A,-1)

In order to return the last cells row in a Mixed column INCLUDING EMPTY(!) cells - use:

=MAX(MATCH(9^15,A:A),MATCH(CHAR(255),A:A,1))

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2014)

ISRAEL

I struggled with this one as well, but came to a better solution using array formula's.

Array formula's allow you to evaluate a formula on each cell in a range, so if you use the array formula:

=MAX(IF(A5:A500="",0,Row(A5:A500)))

then it will tell you the last used row, even if there are blanks in the range A5:A500. Keep in mind that you enter array formula's by pressing Ctrl-Shift-Enter. Excel will present the formula in curly { } braces for you, but you do not enter them yourselves.

You could even use the range A:A, but I do not know what impact that'll have on performance.

Array formula's allow you to evaluate a formula on each cell in a range, so if you use the array formula:

=MAX(IF(A5:A500="",0,Row(A5:A500)))

then it will tell you the last used row, even if there are blanks in the range A5:A500. Keep in mind that you enter array formula's by pressing Ctrl-Shift-Enter. Excel will present the formula in curly { } braces for you, but you do not enter them yourselves.

You could even use the range A:A, but I do not know what impact that'll have on performance.

Hi Jorge,

I have been looking at this for another issue i had.

Place this code in A55

=INDIRECT("a"&COUNTA(A1:A54)-0)

This will look at all the values between A1 and A54 and give you the last used value.

if you want to look at all the values in column A then you will need to move the piece of code to another location to avoid a circular reference error.

the code to look at the whole of column A is

=INDIRECT("a"&COUNTA(A:A)-0)

this will work in any cell which is not in column A.

NB there should be no missing cells of data ie nothing in row 4 but something in row 5. this will stop it working.

Hope this helps.

Andrew

I have been looking at this for another issue i had.

Place this code in A55

=INDIRECT("a"&COUNTA(A1:A54)-0)

This will look at all the values between A1 and A54 and give you the last used value.

if you want to look at all the values in column A then you will need to move the piece of code to another location to avoid a circular reference error.

the code to look at the whole of column A is

=INDIRECT("a"&COUNTA(A:A)-0)

this will work in any cell which is not in column A.

NB there should be no missing cells of data ie nothing in row 4 but something in row 5. this will stop it working.

Hope this helps.

Andrew

Need to get my last cell with data on to another cell.

A

1 $213.00

2 $256.33

3 $100.00

I need to get A3 to A55 cell.

when A4 get updated then A55 will show A4.

When A5 get updated then A55 will show A5.

Hope you can help me here.

A

1 $213.00

2 $256.33

3 $100.00

I need to get A3 to A55 cell.

when A4 get updated then A55 will show A4.

When A5 get updated then A55 will show A5.

Hope you can help me here.

This works - I am able to use the last cell in a particular column in another cell - HOWEVER... what I want to [also] so is add the last cell from rows in other worksheets in the same workbook. How do I do that? What am I missing? Thanks!