Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,670
Default Find last non-blank cell in range

How can I find the last (meaning bottom, or right-most) non-empty cell in a
range?

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Find last non-blank cell in range

Select the range and:

Sub findit()
For Each r In Selection
If IsEmpty(r) Then
Else
s = r.Address
End If
Next
MsgBox (s)
End Sub



--
Gary''s Student - gsnu200753


"Eric" wrote:

How can I find the last (meaning bottom, or right-most) non-empty cell in a
range?

Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,670
Default Find last non-blank cell in range

Thanks for the suggestion.

I'll use a macro if I have to, but what I was hoping to find is a function,
or a series of functions. For example, LAST_NONEMPTY_CELL_VAL(A:A) = 12345,
or LAST_NONEMPTY_CELL_ADDR(A:A) = "A124". Something like that.


"Gary''s Student" wrote:

Select the range and:

Sub findit()
For Each r In Selection
If IsEmpty(r) Then
Else
s = r.Address
End If
Next
MsgBox (s)
End Sub



--
Gary''s Student - gsnu200753


"Eric" wrote:

How can I find the last (meaning bottom, or right-most) non-empty cell in a
range?

Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Find last non-blank cell in range

From your example (column A):

=ADDRESS(MATCH(9.99999999999999E+307,A:A),1) will return the address of the
last used cell IF IT IS A NUMBER

Hence if the above formula is in B1, then:
=INDIRECT(B1) will return the value in that last used cell
--
Gary''s Student - gsnu200753


"Eric" wrote:

Thanks for the suggestion.

I'll use a macro if I have to, but what I was hoping to find is a function,
or a series of functions. For example, LAST_NONEMPTY_CELL_VAL(A:A) = 12345,
or LAST_NONEMPTY_CELL_ADDR(A:A) = "A124". Something like that.


"Gary''s Student" wrote:

Select the range and:

Sub findit()
For Each r In Selection
If IsEmpty(r) Then
Else
s = r.Address
End If
Next
MsgBox (s)
End Sub



--
Gary''s Student - gsnu200753


"Eric" wrote:

How can I find the last (meaning bottom, or right-most) non-empty cell in a
range?

Thanks.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,670
Default Find last non-blank cell in range

Thanks. Getting closer. I think this requires the values to be in ascending
order, doesn't it?

"Gary''s Student" wrote:

From your example (column A):

=ADDRESS(MATCH(9.99999999999999E+307,A:A),1) will return the address of the
last used cell IF IT IS A NUMBER

Hence if the above formula is in B1, then:
=INDIRECT(B1) will return the value in that last used cell
--
Gary''s Student - gsnu200753


"Eric" wrote:

Thanks for the suggestion.

I'll use a macro if I have to, but what I was hoping to find is a function,
or a series of functions. For example, LAST_NONEMPTY_CELL_VAL(A:A) = 12345,
or LAST_NONEMPTY_CELL_ADDR(A:A) = "A124". Something like that.


"Gary''s Student" wrote:

Select the range and:

Sub findit()
For Each r In Selection
If IsEmpty(r) Then
Else
s = r.Address
End If
Next
MsgBox (s)
End Sub



--
Gary''s Student - gsnu200753


"Eric" wrote:

How can I find the last (meaning bottom, or right-most) non-empty cell in a
range?

Thanks.



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Find last non-blank cell in range

Nope. I entered data:

in A1: 1
in A2: 2
in A3:
in A4: 4
in A5:
in A6:
in A7: 6
in A8:
in A9: -10

The formula returns: $A$9
--
Gary''s Student - gsnu200753


"Eric" wrote:

Thanks. Getting closer. I think this requires the values to be in ascending
order, doesn't it?

"Gary''s Student" wrote:

From your example (column A):

=ADDRESS(MATCH(9.99999999999999E+307,A:A),1) will return the address of the
last used cell IF IT IS A NUMBER

Hence if the above formula is in B1, then:
=INDIRECT(B1) will return the value in that last used cell
--
Gary''s Student - gsnu200753


"Eric" wrote:

Thanks for the suggestion.

I'll use a macro if I have to, but what I was hoping to find is a function,
or a series of functions. For example, LAST_NONEMPTY_CELL_VAL(A:A) = 12345,
or LAST_NONEMPTY_CELL_ADDR(A:A) = "A124". Something like that.


"Gary''s Student" wrote:

Select the range and:

Sub findit()
For Each r In Selection
If IsEmpty(r) Then
Else
s = r.Address
End If
Next
MsgBox (s)
End Sub



--
Gary''s Student - gsnu200753


"Eric" wrote:

How can I find the last (meaning bottom, or right-most) non-empty cell in a
range?

Thanks.

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,670
Default Find last non-blank cell in range

Here's what the Excel help text says for Match: "If match_type is 1, MATCH
finds the largest value that is less than or equal to lookup_value.
Lookup_array must be placed in ascending order: ...-2, -1, 0, 1, 2, ..., A-Z,
FALSE, TRUE."

But you're right, it works, though I'm not sure why.

"Gary''s Student" wrote:

Nope. I entered data:

in A1: 1
in A2: 2
in A3:
in A4: 4
in A5:
in A6:
in A7: 6
in A8:
in A9: -10

The formula returns: $A$9
--
Gary''s Student - gsnu200753


"Eric" wrote:

Thanks. Getting closer. I think this requires the values to be in ascending
order, doesn't it?

"Gary''s Student" wrote:

From your example (column A):

=ADDRESS(MATCH(9.99999999999999E+307,A:A),1) will return the address of the
last used cell IF IT IS A NUMBER

Hence if the above formula is in B1, then:
=INDIRECT(B1) will return the value in that last used cell
--
Gary''s Student - gsnu200753


"Eric" wrote:

Thanks for the suggestion.

I'll use a macro if I have to, but what I was hoping to find is a function,
or a series of functions. For example, LAST_NONEMPTY_CELL_VAL(A:A) = 12345,
or LAST_NONEMPTY_CELL_ADDR(A:A) = "A124". Something like that.


"Gary''s Student" wrote:

Select the range and:

Sub findit()
For Each r In Selection
If IsEmpty(r) Then
Else
s = r.Address
End If
Next
MsgBox (s)
End Sub



--
Gary''s Student - gsnu200753


"Eric" wrote:

How can I find the last (meaning bottom, or right-most) non-empty cell in a
range?

Thanks.

  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Find last non-blank cell in range

To return the last numerical value...

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

Hope this helps!

On Nov 1, 1:45 pm, Eric wrote:
How can I find the last (meaning bottom, or right-most) non-empty cell in a
range?

Thanks.



  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,202
Default Find last non-blank cell in range

How can I find the last (meaning bottom, or right-most)
non-empty cell in a range?


I think these should work for you....

Last Used Column
***********************
=SUMPRODUCT(MAX((COLUMN(A1:H17)*(A1:H17<""))))

Last Used Row
***********************
=SUMPRODUCT(MAX((ROW(A1:H17)*(A1:H17<""))))

Change the ranges to suit your needs.

Rick
  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,202
Default Find last non-blank cell in range

How can I find the last (meaning bottom, or right-most)
non-empty cell in a range?


I think these should work for you....

Last Used Column
***********************
=SUMPRODUCT(MAX((COLUMN(A1:H17)*(A1:H17<""))))

Last Used Row
***********************
=SUMPRODUCT(MAX((ROW(A1:H17)*(A1:H17<""))))

Change the ranges to suit your needs.


I think I misread what you wanted. I think the following does what you
want...

Last Used Column
**************************************************
=SUMPRODUCT(MAX((COLUMN(A1:H17)*(A1:H17<""))))

Last Non-Used Cell in Last Used Column
**************************************************
=1+SUMPRODUCT(MAX((COLUMN(INDIRECT("A"&SUMPRODUCT( MAX((ROW(A1:H17)*(A1:H17<""))))&":"&"H"&SUMPRODUC T(MAX((ROW(A1:H17)*(A1:H17<""))))))*(INDIRECT("A" &SUMPRODUCT(MAX((ROW(A1:H17)*(A1:H17<""))))&":"&" H"&SUMPRODUCT(MAX((ROW(A1:H17)*(A1:H17<"")))))<" "))))

I'm pretty sure there are more efficient formulas to be had. Anyway, while
I'm looking for them, you can use the above in the meantime...

Rick



  #11   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,670
Default Find last non-blank cell in range

Thanks! That formula is a lesson in itself. It will take me a while to
figure it out, but I'm sure I'll learn a lot in the process.

"Rick Rothstein (MVP - VB)" wrote:

How can I find the last (meaning bottom, or right-most)
non-empty cell in a range?


I think these should work for you....

Last Used Column
***********************
=SUMPRODUCT(MAX((COLUMN(A1:H17)*(A1:H17<""))))

Last Used Row
***********************
=SUMPRODUCT(MAX((ROW(A1:H17)*(A1:H17<""))))

Change the ranges to suit your needs.


I think I misread what you wanted. I think the following does what you
want...

Last Used Column
**************************************************
=SUMPRODUCT(MAX((COLUMN(A1:H17)*(A1:H17<""))))

Last Non-Used Cell in Last Used Column
**************************************************
=1+SUMPRODUCT(MAX((COLUMN(INDIRECT("A"&SUMPRODUCT( MAX((ROW(A1:H17)*(A1:H17<""))))&":"&"H"&SUMPRODUC T(MAX((ROW(A1:H17)*(A1:H17<""))))))*(INDIRECT("A" &SUMPRODUCT(MAX((ROW(A1:H17)*(A1:H17<""))))&":"&" H"&SUMPRODUCT(MAX((ROW(A1:H17)*(A1:H17<"")))))<" "))))

I'm pretty sure there are more efficient formulas to be had. Anyway, while
I'm looking for them, you can use the above in the meantime...

Rick


  #12   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Find last non-blank cell in range

I know this is old but this did exactly what was asked (and what I wanted to
do) Thank you.

" wrote:

To return the last numerical value...

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

Hope this helps!

On Nov 1, 1:45 pm, Eric wrote:
How can I find the last (meaning bottom, or right-most) non-empty cell in a
range?

Thanks.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find within range & Replace with Blank Value JG14 Excel Discussion (Misc queries) 4 July 13th 07 05:06 PM
How do I find the next blank cell in a range? EazyCure Excel Worksheet Functions 6 June 11th 07 09:14 PM
Find First Non blank cell than find column header and return that value Silver Rose Excel Worksheet Functions 10 April 30th 07 05:56 PM
find the first and last non blank cell in a row Allan from Melbourne Excel Discussion (Misc queries) 3 May 19th 06 01:12 PM
find the first blank cell in a range and return me it's position steve alcock Links and Linking in Excel 2 May 13th 05 09:03 AM


All times are GMT +1. The time now is 09:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"