Thread: LOOKUP ( )
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Coderre Ron Coderre is offline
external usenet poster
 
Posts: 2,118
Default LOOKUP ( )

Did you mean to use this version?:
=LOOKUP(2,1/(A1:A100<""),A1:A100)

In that formula, this section:(A1:A100<"")
returns a series of 1's(for non-blanks) and 0's(for blanks)...or error
values (for cells that contain errors)

Consequently, the fraction 1/(A1:A100<"") returns 1's(for non-blanks) and
errors for blanks or errors.
Since there will be no 2's for the LOOKUP to find, it will match on the last
non-error value (LOOKUP ignores errors in the lookup range) and return the
corresponding value.

That version has advantages over the formula you posted:
=LOOKUP(2,1/A1:A100,A1:A100)

Among them are these:
If the lookup range is in the right order and happens to contain 0.5 in the
right place, 1/0.5 would calculate to 2, resulting in a match.
OR a last value of zero in the lookup range would be ignored because the
resulting fraction would be an error.

Does that help?
***********
Regards,
Ron

XL2002, WinXP


"Epinn" wrote:

Hi,

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

The following is my interpretation of this formula. If I am wrong, please correct me.

I read that there is vector form and array form for LOOKUP. This is vector form, right? Since the purpose is to find the last value in the array, there is no need to sort the array in ascending order. 1/A1:A100 is to reduce all values in the array to less than 1. If we use "2" as the lookup value, we won't find a match. As a result, we will be returned with the position of the last cell in the column that contains a non-blank and non-zero value. Then we use the position to lookup the "result vector" which in this case is the same as the "lookup vector." We don't necessarily have to use "2" as the lookup value; anything greater than 1 is fine e.g. 7, 50, 99 or even 1.5.

Thanks for your help.

Epinn