How to refer to the last cell in a row in Excel?
Solution 1
If you want a regular worksheet function, this might work... you do need to restrict the range, but this will provide the last number, last text string, or last anything. This example shows a column, but works the same for a row range:
Number: =LOOKUP(2, 1/ISNUMBER($A$1:$A$30), $A$1:$A$30)
Text: =LOOKUP(2, 1/ISTEXT($A$1:$A$30), $A$1:$A$30)
Anything: =LOOKUP(2, 1/($A$1:$A$30<>""), $A$1:$A$30)
Solution 2
Try this for indpendance from the active sheet
Function LastCellInRow(rw As Range) As Variant
LastCellInRow = rw.EntireRow.Cells(1, rw.Worksheet.Columns.Count).End(xlToLeft).Value
End Function
Related videos on Youtube
zazvorniki
Updated on September 18, 2022Comments
-
zazvorniki over 1 year
I have a link on the site I'm working on that is giving me issues in chrome. In firefox and ie (I will never say this again) is working as it should, but chrome is showing me this message.
And it's not quite making sense. There is only one redirect going on after you click on the site. Is there anyway to fix this in Chrome? I have cleared my history/cookies/cache.
I will provide as much info as I can, but at this moment I'm not sure what to include to help.
-
chris neilsen about 12 yearsThese will return the last value on the
active
sheet only.