View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default #N/A coming up in VLOOKUP when visibly the two cells are same

Probably because the data within the lookup col in the vlookup's table_array
and the lookup values may not be consistent.

For example: If it's numbers being matched, these need to be consistent:
either match text numbers vs text numbers, or real numbers vs real numbers
(lookup values vs lookup col in table _array)

So instead of say:
=VLOOKUP(A2,Sheet2!A:B,2,FALSE)

Try it as:
=VLOOKUP(A2+0,Sheet2!A:B,2,FALSE)
The "+0" is one way to coerce the text lookup number in A2 to a real number

Or, try:
=VLOOKUP(A2&"",Sheet2!A:B,2,FALSE)
to convert the real number in A2 to a text number
so that it will match the text numbers in the lookup col of the table_array

Or, try something like:
=VLOOKUP(TEXT(A2,"0000"),Sheet2!A:B,2,FALSE)
where there are leading zeros in the text numbers [to 4 digits]
in the lookup col of the table_array (eg: 0010, 0100, 0002, etc)
(Adapt the "0000" to suit the format in the table_array)

If it's text being matched, try:
=VLOOKUP(TRIM(A2),Sheet2!A:B,2,FALSE)
if there could be extraneous "invisible" whitespaces within the lookup value
in A2

Or, if its the other way around, try trimming col A in Sheet2 (the lookup
col in the table_array). In Sheet2, just place in say C1: =TRIM(A1), copy
down. Then cut-out col C and paste special as values to overwrite col A
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Marcus Bolton" wrote:
I have tried this a few times and tried to copy and paste but it still keeps
coming back with #N/A but if I double click in the cell that I am trying to
find it then finds it, hope this makes sense