FIND THE LAST CELL ENTRY IN A ROW
====================
=LOOKUP(MAX(A1:Z1)+1,A1:Z1)
Why go through the range twice? Also, if there were any errors in the range,
the MAX call and thus the LOOKUP call would propagate the first error
encountered. Use .999999999999999E308 rather than the MAX call to be sure to
return the last numeric value if there are any.
====================
It's just a personal preference. It's easier than trying to count the number
of 9s when typing .999999999999999E308 or 9.99999999999999E+307. There's no
doubt it's more efficient but I also believe that the vast majority of
spreadsheets are not so robust that efficiency is a primary concern. At the
most, that formula only goes through a full row. That is a good point about
the possibility of errors, though.
Biff
"Harlan Grove" wrote in message
...
"Biff" wrote...
Take your pick:
If the data is numeric:
=LOOKUP(MAX(A1:Z1)+1,A1:Z1)
...
Why go through the range twice? Also, if there were any errors in the
range, the MAX call and thus the LOOKUP call would propagate the first
error encountered. Use .999999999999999E308 rather than the MAX call to be
sure to return the last numeric value if there are any.
If the data is mixed:
=LOOKUP(2,1/(A1:Z1<""),A1:Z1)
Begging the question what to do if the last nonblank (strict sense) cell
evaluates to "". An alternative,
=LOOKUP(2,1/(1-ISBLANK(A1:Z1)),A1:Z1)
Actually, light testing shows that the following work.
=LOOKUP(TRUE,ISNUMBER(A1:Z1),A1:Z1)
=LOOKUP(TRUE,ISTEXT(A1:Z1),A1:Z1)
=LOOKUP(TRUE,NOT(ISBLANK(A1:Z1)),A1:Z1)
|