vlookup bug

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

when using vlookup on a list - I often find that I get N/A as an answer
unless I retype the item I am looking up. When I retype the value that I am
looking up, the correct corresponding value is then pulled from the list....
is there a workaround for this other than to retype every value you have to
look up?
thanks
 
VLOOKUP is tricky. Copy and paste the formula you're using into a response.
Hard to diagnose without looking at your formula.

Dave
 
VLOOKUP is very picky about the values matching exactly. For example, if the
values are strings and one of them has leading or trailing spaces you won't
get a match. Also, if the values are numbers but one of them is formatted as
text and the other as a number you won't get a match. For this second
scenario you can place the number 1 in an unused cell (that is formatted as a
number or general) and then copy/paste special/multiply to the values that
you want to change to numbers. This will convert them.

Hope this helps.
Will
 
Dave-
here's formula
=VLOOKUP(M2,Keys!A3:B24,2)

I have checked to see that the values that are looked up and the values in
the table list are the same format. There are no leading or trailing spaces
in the values. The only way I have been able to get this vlookup to work is
to retype the value in the table (M2). I have had this happen many times and
this time the table is just too big for me to shrug my shoulders and just
start retyping the values!
thanks
Pat
 
when using vlookup on a list - I often find that I get N/A as an
answer unless I retype the item I am looking up. When I retype the
value that I am looking up, the correct corresponding value is then
pulled from the list.... is there a workaround for this other than to
retype every value you have to look up?

Sometimes, a cell can have an extra space in a text string. You can't tell
by looking. Careful use of the TRIM function can help.
 
See the other responses. Very likely your original values have excess spaces.

Dave
 
I've checked the formats and they match; i've reformatted the same cells-
just to be sure; I've checked for leading and trailing spaces; the only thing
that works is to retype the number that is being looked up-
 
=================================================================
Your Numbers don't behave (like numbers)
Niek Otten, May 11, 2006

Your numbers sort incorrectly, are not included in SUMs, cause #VALUE! results in formulas, cannot be found in LOOKUPs, etc.
In short:

Your Numbers look like Numbers, but they really are Text.
Sure! You formatted them as numbers, but alas, formatting afterwards doesn't help. Believe me, they are Text!

Here's a checklist which will help you solve most known cases. Make a copy of your workbook before trying! Always use Excel's
ISNUMBER() function to check your cells; maybe you solved your problem in the first step!

· Format an empty cell as Number. Enter the number 1 in it. Edit>Copy.
Select your "numbers". Edit>Paste Special, check Multiply. Hopefully your cells are "real" Numbers now
· If that doesn't help, there may be spaces in your "numbers". You can use the LEN() function to compare the number
of characters that Excel sees in the cell with the number of characters you see. If you suspect spaces, use Excel's TRIM()
function to remove them
· If that doesn't help, there may be nonprintable characters in your "numbers". You can use Excel's CLEAN() function
to remove most of them
· If that doesn't help, there may be non-breaking spaces in your "numbers" (mostly acquired from Web Pages). Use
David McRitchie's TRIMALL() function to remove them. It can be downloaded here:
http://www.mvps.org/dmcritchie/excel/join.htm#trimall



=================================================================

--
Kind regards,

Niek Otten
Microsoft MVP - Excel


| when using vlookup on a list - I often find that I get N/A as an answer
| unless I retype the item I am looking up. When I retype the value that I am
| looking up, the correct corresponding value is then pulled from the list....
| is there a workaround for this other than to retype every value you have to
| look up?
| thanks
 
Simply re-formatting the cells does not change the fact that the numbers are
text.

You must coerce them to become numbers.

Format all to General.

Copy an empty cell and Edit>Paste Special(in place)>Add>OK>Esc.


Gord Dibben MS Excel MVP
 
Niek- the cells are formatted "General". There are no leading space or
trailing spaces. One other fix I just found is to move onto the cell, hit F2
then move off of the cell..... this corrects the problem.
 
Hi Patricia,

That's exactly what I wrote. I also wrote the solution(s).Please read the entire text.

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

| Niek- the cells are formatted "General". There are no leading space or
| trailing spaces. One other fix I just found is to move onto the cell, hit F2
| then move off of the cell..... this corrects the problem.
|
| "Niek Otten" wrote:
|
| > =================================================================
| > Your Numbers don't behave (like numbers)
| > Niek Otten, May 11, 2006
| >
| > Your numbers sort incorrectly, are not included in SUMs, cause #VALUE! results in formulas, cannot be found in LOOKUPs,
etc.
| > In short:
| >
| > Your Numbers look like Numbers, but they really are Text.
| > Sure! You formatted them as numbers, but alas, formatting afterwards doesn't help. Believe me, they are Text!
| >
| > Here's a checklist which will help you solve most known cases. Make a copy of your workbook before trying! Always use
Excel's
| > ISNUMBER() function to check your cells; maybe you solved your problem in the first step!
| >
| > · Format an empty cell as Number. Enter the number 1 in it. Edit>Copy.
| > Select your "numbers". Edit>Paste Special, check Multiply. Hopefully your cells are "real" Numbers now
| > · If that doesn't help, there may be spaces in your "numbers". You can use the LEN() function to compare the
number
| > of characters that Excel sees in the cell with the number of characters you see. If you suspect spaces, use Excel's TRIM()
| > function to remove them
| > · If that doesn't help, there may be nonprintable characters in your "numbers". You can use Excel's CLEAN()
function
| > to remove most of them
| > · If that doesn't help, there may be non-breaking spaces in your "numbers" (mostly acquired from Web Pages). Use
| > David McRitchie's TRIMALL() function to remove them. It can be downloaded here:
| > http://www.mvps.org/dmcritchie/excel/join.htm#trimall
| >
| >
| >
| > =================================================================
| >
| > --
| > Kind regards,
| >
| > Niek Otten
| > Microsoft MVP - Excel
| >
| >
| > | > | when using vlookup on a list - I often find that I get N/A as an answer
| > | unless I retype the item I am looking up. When I retype the value that I am
| > | looking up, the correct corresponding value is then pulled from the list....
| > | is there a workaround for this other than to retype every value you have to
| > | look up?
| > | thanks
| >
| >
| >
 
Patricia, try this:

highlight column A of your Keys sheet, click Data | Text-to-columns,
then click Finish when the first panel pops up - this usually clears
the type of error you describe, rather than pressing F2 on every cell
in turn.

Hope this helps.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top