Find Last Numeric Cell Using Formulas

parry

MrExcel MVP
Joined
Aug 20, 2002
Messages
3,355
How can you obtain the address of the last numeric cell in a range by using formulas? In the following example the last numeric cell in row 1 is E1. Cell F1 contains a formula which returns "" and is treated as text as per the type formula shown. Ctrl-RightArrow from cell A1 returns F1 as the last used cell in the row.

I can do this with a custom function or sub but how about a formula?
I have tried =ADDRESS(1,COUNTA(1:1)) but this returns cell F1. Any ideas?
Tammy.xls
ABCDEFG
1122213 34 
212221334
3
4TypevalueofcellF12(Text)
5LastCellusingCountA$F$1
6
Sheet1
 
Hi Parry:

One caution here --

In my formulation, the MATCH function looks in the specified range for 9.99999999999999E+307 (largest possible number that EXCEL can handle) -- and if it finds it -- returns that entry

So, if the number 9.99999999999999E+307 happens to be within the specified range, we would get an incorrect result

Please refer to the following illustration ...
y031222h1.xls
ABCDEFGHIJKLM
11222__1334abck9.99999999999999E+3075668
2addressoflastnumericentryinrow1$J$1
31222__1334abck9.99999999999999E+307-15668
4addressoflastnumericentryinrow3$M$1
Sheet9


In row 1, I have housed 9.99999999999999E+307 in cell J1, so my formulation erroneously tells me that my last numeric entry is in cell J1, even though my last numeric entry is in cell M1

However, since I know EXCEL is trying to home in on 9.99999999999999E+307, in row 3, if I change the entry in cell J3 to 9.99999999999999E+307-1, now I can make EXCEL correctly report to me that the last numeric entry in row 3 is in column M

Practically speaking, this is not of concern because we will not be dealing with the largest possible number that EXCEL can handle anyway -- but I thought I will share this concern with you.
 
Upvote 0

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Welcome to the board, DBudd.

Use Index() instead of Address(). Search the board for 'BigNum'. ;)
 
Upvote 0
DBudd said:
How do you get the number to show so you can use it in a Formula

=LOOKUP(9.99999999999999E+307,Range)

where Range can be something like A2:A100, B:B, or B2:F2, all one-dimensional. Note that the formula fetches the last numeric value from Range.

Is this what you are asking for?
 
Upvote 0
Yes that work thanks. But also is there a way to have it find the last number in a row then move up one cell and display that number?
 
Upvote 0
DBudd said:
Yes that work thanks. But also is there a way to have it find the last number in a row then move up one cell and display that number?

You mean the numeric next-to-last value? And, what is the range of interest?
 
Upvote 0
I am working with coordinates and I have a formula that needs to use next to the last value of a column.
 
Upvote 0
DBudd said:
I am working with coordinates and I have a formula that needs to use next to the last value of a column.

Supposing that the range of interest is column A and the data starts at row 2...

The last numeric value:

=LOOKUP(9.99999999999999E+307,A2:A65536)

The numeric next-to-last numeric value:

=LOOKUP(9.99999999999999E+307,A2:INDEX(A2:A65536,MATCH(9.99999999999999E+307,A2:A65536)-1))
 
Upvote 0

Forum statistics

Threads
1,215,330
Messages
6,124,308
Members
449,152
Latest member
PressEscape

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top