Search code examples
excelfindcellexcel-2008

Find name of the last cell with data in a row


I've searched for an answer, but it seems that I can only find VBA-based solutions, which appear no longer be an option in Excel 2008.

I'm trying to return the name of the last cell in a row that contains data. It looks like this:

+===========================================================+
                 A      /  B  /  C  /  D  /  E  (columns)
+===========================================================+
1         || [Formula] /  3  /  4  /  5  / [blank]
2         || [Formula] /  7  /  8  / [blank] / [blank]
3         || [Formula] /  9  / 10 / 11 / 12
(rows)
+===========================================================+

and the end result would look like this:

+===========================================================+
             A   /  B  /  C  /  D  /  E  (columns)
+===========================================================+
1         || D1 /  3  /  4  /  5  / 
2         || C2 /  7  /  8  /     / 
3         || E3 /  9  / 10 / 11 / 12
(rows)
+===========================================================+

Solution

  • It looks like your data is sorted from left to right.
    If it is, you could start with something like =MATCH(MAX(C4:K4);C4:K4) to retrieve the column index of the last cell (max) of the row. From there, it's easy to buid the address:
    =ADDRESS(ROW();MATCH(MAX(C1:K1);C1:K1);4)


    Edit: combining ADDRESS with COUNT or COUNTA (great idea from Dustin Geile) does not require the items to be sorted:

    =ADDRESS(ROW();COLUMN()+COUNT(B1:Z1);4)