Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 74
Default Last NonBlank In Ranger

In reference to my earlier post, I had another idea that may be simpler.

Is there a formula to identify the last nonblank cell in a range?

Thanks,


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Last NonBlank In Ranger

Use this User Defined Function:

Function lastnb(r As Range) As String
lastnb = ""
For Each cell In r
If cell.Value = "" Then
Else
lastnb = cell.Address
End If
Next
End Function

--
Gary''s Student - gsnu200805


"Brent E" wrote:

In reference to my earlier post, I had another idea that may be simpler.

Is there a formula to identify the last nonblank cell in a range?

Thanks,


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,393
Default Last NonBlank In Ranger

Some samples found with a Google search "Excel last non blank"

=ROW(OFFSET(A1,COUNTA(A:A)-1,0))

=index($a:$a,match(-9e+306,$a:$a,-1),1) (array forula - use
ctrl+shift+enter)

Function LASTINROW(rngInput As Range) As Variant
Dim WorkRange As Range
Dim i As Integer, CellCount As Integer
Application.Volatile
Set WorkRange = rngInput.Rows(1).EntireRow
Set WorkRange = Intersect(WorkRange.Parent.UsedRange, WorkRange)
CellCount = WorkRange.Count
For i = CellCount To 1 Step -1
If Not IsEmpty(WorkRange(i)) Then
LASTINROW = WorkRange(i).Value
Exit Function
End If
Next i
End Function
=LOOKUP(255,A2:Z2) - for numeric value
=LOOKUP(REPT("z",255),A2:Z2) - for text value

For the last numerical value in a range, try...
=LOOKUP(9.99999999999999E+307,Range)

INDEX(1:1,MAX(INDEX(COLUMN(1:1)*(NOT(ISBLANK(1:1)) ),))) to get the last
non-blank value in my current worksheet.

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Brent E" wrote in message
...
In reference to my earlier post, I had another idea that may be simpler.

Is there a formula to identify the last nonblank cell in a range?

Thanks,




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 74
Default Last NonBlank In Ranger

Great. Thanks guys. I'll give those a try.

"Bernard Liengme" wrote:

Some samples found with a Google search "Excel last non blank"

=ROW(OFFSET(A1,COUNTA(A:A)-1,0))

=index($a:$a,match(-9e+306,$a:$a,-1),1) (array forula - use
ctrl+shift+enter)

Function LASTINROW(rngInput As Range) As Variant
Dim WorkRange As Range
Dim i As Integer, CellCount As Integer
Application.Volatile
Set WorkRange = rngInput.Rows(1).EntireRow
Set WorkRange = Intersect(WorkRange.Parent.UsedRange, WorkRange)
CellCount = WorkRange.Count
For i = CellCount To 1 Step -1
If Not IsEmpty(WorkRange(i)) Then
LASTINROW = WorkRange(i).Value
Exit Function
End If
Next i
End Function
=LOOKUP(255,A2:Z2) - for numeric value
=LOOKUP(REPT("z",255),A2:Z2) - for text value

For the last numerical value in a range, try...
=LOOKUP(9.99999999999999E+307,Range)

INDEX(1:1,MAX(INDEX(COLUMN(1:1)*(NOT(ISBLANK(1:1)) ),))) to get the last
non-blank value in my current worksheet.

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Brent E" wrote in message
...
In reference to my earlier post, I had another idea that may be simpler.

Is there a formula to identify the last nonblank cell in a range?

Thanks,





  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,572
Default Last NonBlank In Ranger

Non-array, non-volatile formula for contents of last, non-blank cell in a
range:

=LOOKUP(2,1/(A1:A100<""),A1:A100)


--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------

"Brent E" wrote in message
...
Great. Thanks guys. I'll give those a try.

"Bernard Liengme" wrote:

Some samples found with a Google search "Excel last non blank"

=ROW(OFFSET(A1,COUNTA(A:A)-1,0))

=index($a:$a,match(-9e+306,$a:$a,-1),1) (array forula - use
ctrl+shift+enter)

Function LASTINROW(rngInput As Range) As Variant
Dim WorkRange As Range
Dim i As Integer, CellCount As Integer
Application.Volatile
Set WorkRange = rngInput.Rows(1).EntireRow
Set WorkRange = Intersect(WorkRange.Parent.UsedRange, WorkRange)
CellCount = WorkRange.Count
For i = CellCount To 1 Step -1
If Not IsEmpty(WorkRange(i)) Then
LASTINROW = WorkRange(i).Value
Exit Function
End If
Next i
End Function
=LOOKUP(255,A2:Z2) - for numeric value
=LOOKUP(REPT("z",255),A2:Z2) - for text value

For the last numerical value in a range, try...
=LOOKUP(9.99999999999999E+307,Range)

INDEX(1:1,MAX(INDEX(COLUMN(1:1)*(NOT(ISBLANK(1:1)) ),))) to get the last
non-blank value in my current worksheet.

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Brent E" wrote in message
...
In reference to my earlier post, I had another idea that may be
simpler.

Is there a formula to identify the last nonblank 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
how to return the value of the last nonblank cell in a row? WINDMILL Excel Discussion (Misc queries) 2 January 25th 07 01:31 PM
define nonblank in a formula anand Excel Worksheet Functions 1 January 15th 07 10:44 AM
How do I countif the criteria is a nonblank? Todd Excel Worksheet Functions 3 May 16th 06 07:43 PM
Require a cell to be nonblank if another cell is nonblank Herb Wexler Excel Discussion (Misc queries) 1 February 1st 06 08:05 PM
Adding NonBlank Cells Emily8 Excel Worksheet Functions 3 January 4th 05 06:16 PM


All times are GMT +1. The time now is 10:03 PM.

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"