View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove Harlan Grove is offline
external usenet poster
 
Posts: 733
Default Excel 2002 VLOOKUP Weird

TRJ wrote...
=VLOOKUP(A25,Master,3,FALSE) - pretty simple. As I described in GREAT detail,
this has all worked previously (standard formula) but something has gotten
corrupted??

....

If this is returning #N/A, then the first thing to check would be the
return result from the formula

=COUNTIF(INDEX(Master,0,1),A25)

This returns how many instances of the value in cell A25 there are in
the first column of the range named Master. If this formula returns
zero, there are no instances. If it returns a positive number, then
the only way your VLOOKUP formula would return #N/A would be due to
referenced cell in Master containing the value #N/A.

If the COUNTIF formula returns zero, then does A25 contain a numeric
or text value? If A25 should contain numeric values, next thing to try
is

=SUMPRODUCT(COUNTIF(INDEX(Master,0,1),"<"&(A25+{-0.1;0.1})),{-1;1})

This returns the count of values in the first column of Master that
are withing -/+0.1 of the value in cell A25. Use something other than
{-0.1;0.1} if your A25 and first column of Master values could be
fractional values. If this formula returns a positive number, then
you're dealing with fractional values that aren't exactly equal. If
all values should be whole numbers, change your VLOOKUP formula to

=INDEX(Master,MATCH(ROUND(A25,0),ROUND(INDEX(Maste r,0,1),0),0),3)

On the other hand, if A25 and the first column in Master should
contain text values, then trailing spaces are the usual reason for
VLOOKUP failing. Just in case Master comes from an HTML table, try
this formula.

=SUMPRODUCT(--(RIGHT(INDEX(Master,0,1),1)=CHAR({32;160})))

If this formula returns a positive number, then trailing space
characters are likely causing the problem. The easiest way to deal
with them would be to use the first blank column on either side of the
Master range to hold the array formula

=TRIM(SUBSTITUTE(INDEX(Master,0,1),CHAR(160)," "))

Copy the column containing this array formula, select the first column
in Master, paste special as values, then clear the column containing
the array formula. This will have replaced all HTML nonbreaking spaces
(decimal character code 160) with plain ASCII spaces, then deleted any
leading or trailing spaces and replaced all instances of multiple
spaces with single spaces. At this point, you should be able to use

=VLOOKUP(TRIM(A25),Master,3,0)