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
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
parry said:
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?

...

=CELL("Address",INDEX(1:1,MATCH(9.99999999999999E+307,1:1)))
 
Upvote 0
Very clever Yogi! Thank you very much. Ive seen other people like Aladin use big numbers like that as well but I clean forgot about it. I must take more notes :)

Im curious, what forces Excel to go to the last numeric when the number is so large?
 
Upvote 0
Thank you Aladin. Can you direct me to a site that explains what a binary search is or briefly explain this?
 
Upvote 0
Hi Parry:

In trying to locate this largest possible number in the specified range EXCEL looks at all cells in the range with numeric entry, and when it reaches the last numeric entry in the range and (if this is equal to or smaller than the number to be matched -- and it is) so it returns that entry.
 
Upvote 0
Yogi Anand said:
Hi Parry:

In trying to locate this largest possible number in the specified range EXCEL looks at all cells in the range with numeric entry, and when it reaches the last numeric entry in the range and (if this is equal to or smaller than the number to be matched -- and it is) so it returns that entry.

It doesn't look at all cells when a binary search routine is invoked.
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,383
Members
448,955
Latest member
BatCoder

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