简体   繁体   English

VLookup不返回结果

[英]VLookup not returning the results

I'm not sure why my VLOOKUP formula is not working like the screenshot below. 我不确定为什么我的VLOOKUP公式无法像下面的屏幕截图那样工作。 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. 我想在G列中输出值,但是将第3个参数更改为1或2无效。

Help is appreciated. 感谢帮助。 Thanks much in advance. 在此先感谢。

Formula: = VLOOKUP(B2,$F$1:$G$421,2,FALSE) 公式:= 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. 选择(依次)选择B2F1然后使用公式框中的箭头键检查情况是否如此。

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). 在这种情况下,我倾向于(暂时)将B2设置为公式=F1只是为了查看它是否可以找到保证的匹配(然后使用CTRL-Z还原)。

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). 如果该更改导致查找正常工作,那么(原始) B2F1显然不是相同的值,您需要找出原因(隐藏的空格,错误的类型,等等)。

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. 要将源转换为数字,请使用excel函数,例如int或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. 如果您要在文本和数字混合的地方进行查找(即在实数列表中查找数字的文本版本),也可以使用VALUE函数...这将转换存储为文本的数字到实数。
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... 将存储为文本的数字更改为数字,但保留其他文本不变...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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