>Hi Ron,
>
[quoted text clipped - 10 lines]
>
>Many thanks
I doubt you would "muck anything up", at least not irretrievably (back up your
data first), but I'm glad you got the worksheet function to work.
How does it work?
Let's Dissect:
LEN(3:3)=0 returns TRUE or FALSE for each cell in Row 3. This is similar to
ISBLANK(3:3) except it will also return FALSE if a formula in the cell is
returning ' "" '.
1-LEN(3:3)=0 coerces the TRUE FALSE return to a 0 or -1 so that when it is made
the denominator in the 1/(...), the TRUE's will give a DIV/0 error, and the
FALSE's will give a 1.
I had adapted this from the ISBLANK variation of this formula, late at night
without thinking. However, this part of the equation could (should?) be
simplified to: LEN(3:3) and no need to subtract.
So now we have the simplified version:
LEN(3:3) will return an array of values equal to the various lengths of the
strings in the cells. It might look something like
{1,0,1,0,7,0,2,0,1,1,5,1,0,0,0,0, ...}
Then, dividing that into 1
1/LEN(3:3) returns an array of either numbers, or DIV/0 errors.
{1,#DIV/0!,1,#DIV/0!,0.142857142857143,#DIV/0!,0.5,#DIV/0!,1,1,0.2,1,0.3,#DIV/0!,#DIV/0!,#DIV/0!,...}
Now you should look at HELP for the vector form of the LOOKUP function in order
to follow along.
If the vector form of the LOOKUP function is given a BIG NUMBER as an argument,
one that does not appear in the array, it will match with the LAST numeric
value in the array. LOOKUP will ignore error values. In an array constructed
as above, the last numeric value has to match with the last entry that has
LEN>0. All the other entries will return errors. Since we are dividing LEN
into "1", no value can be greater than 1; so 2 must be larger than any returned
value; meeting the conditions to match with the last numeric value.
We then return the corresponding value that is in result_vector which, since it
is the same dimension as lookup_vector, will be the actual value.
Going through this exercise, and having had a bit of sleep, allows me to
simplify the function a bit:
=LOOKUP(2,1/LEN(3:3),3:3)
should do the same thing as above.
--ron
Stats - 15 Feb 2008 09:49 GMT
> >Hi Ron,
>
[quoted text clipped - 60 lines]
>
> --ron
Many thanks again for taking the time to help Ron!!!!!!!!