Function to get the last value of a column

We have a column with formulas per each row that its results can ether be blank or alphanumeric value.  We are using =LOOKUP(2,1/(1-ISBLANK(H4:H291)),H4:H291) so we can get the last value of said column.  The problem we are facing that the formula doesn't return the last value.  the included excel shows the formula and yet the last vale no matter where is at, wont be displayed at top yellow cell.

Please advice on the proper formula.
LastRowValue.xlsx
rayluvsAsked:
Who is Participating?
 
Subodh Tiwari (Neeraj)Connect With a Mentor Excel & VBA ExpertCommented:
Try one of the following formulas...

=LOOKUP(2,1/(H4:H11<>""),H4:H11)

Open in new window


OR
If the values in the range are numeric...
=INDEX(H4:H11,MATCH(9^9,H4:H11))

Open in new window


OR
If the values in the range are alphanumeric...
=INDEX(H4:H11,MATCH("zzz",H4:H11))

Open in new window

1
 
rayluvsAuthor Commented:
The first one worked.

Prior closing I would like to understand it, please provide brief explanation.

Thank you
0
 
Subodh Tiwari (Neeraj)Connect With a Mentor Excel & VBA ExpertCommented:
(H4:H11<>"") evaluates to {FALSE;TRUE;FALSE;TRUE;FALSE;FALSE;TRUE;FALSE} and False is equivalent to 0 and True is equivalent to 1.
When 1 is divided by {FALSE;TRUE;FALSE;TRUE;FALSE;FALSE;TRUE;FALSE}, it returns either #DIV/0! (divided by zero) error or 1 i.e. {#DIV/0!;1;#DIV/0!;1;#DIV/0!;#DIV/0!;1;#DIV/0!} so your formula becomes...

=LOOKUP(2,{#DIV/0!;1;#DIV/0!;1;#DIV/0!;#DIV/0!;1;#DIV/0!},H4:H11)

where 2 is lookup value, {#DIV/0!;1;#DIV/0!;1;#DIV/0!;#DIV/0!;1;#DIV/0!} is the lookup_vector and H4:H11 is the result_vector and since Lookup returns the approximate match, it picks up the last 1 (true) and returns the corresponding value from the result vector.

Hope this helps.
0
 
rayluvsAuthor Commented:
Thank you
0
 
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
You're welcome!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.