简体   繁体   中英

VLookup not returning the results

I'm not sure why my VLOOKUP formula is not working like the screenshot below. The value is right there as highlighted. I want to output the value in Column G, but changing the 3rd parameter to 1 or 2 doesn't work.

Help is appreciated. Thanks much in advance.

Formula: = VLOOKUP(B2,$F$1:$G$421,2,FALSE)

在此处输入图片说明

One thing you may want to look at.

I notice your data is left justified and that's normally the case for textual rather than numeric fields - it's possible to left justify numerics but it's neither the default nor the general practice.

If they are textual, there's a chance one or more of them may have leading or trailing spaces. That would prevent the lookup from finding a match.

Select (in turn) B2 and F1 and use the arrow keys in the formula box to check this is not the case.

In cases like this, I tend to (temporarily) set B2 to the formula =F1 just to see if it can find a match that's guaranteed (then use CTRL-Z to revert).

If that change results in the lookup working then obviously the (original) B2 and F1 are not the same value, and you need to work out why (hidden spaces, wrong types, and so on).

It looks like you are comparing text to number (see the green triangle in your value cell). You have to convert the value in your source cell or matching cells to same type. To convert source to number use excel function such as int or value. Hope this helps.

将文本转换为数字格式的另一种方法是乘以1,然后用这些新的数字值替换原始文本值...

If you are doing lookup where you have a mix of text and numbers (ie looking up a text version of a number in a list of real numbers) you can also make use of the VALUE function... this will convert numbers stored as text to real numbers.
Embed it like so:

=VLOOKUP(VALUE(B2),$F$1:$G$421,1,FALSE)

If you have a mix of text numbers and text text to look up in numbers/text then you can do:

=VLOOKUP(IFERROR(VALUE(B2),B2),$F$1:$G$421,1,FALSE)

to change numbers stored as text to numbers, but leave other text as is...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM