简体   繁体   English

使用公式填充查找值单元格时出现 vlookup 错误

[英]vlookup error when lookup value cell has been populated with formula

I have the following formula which is producing a #N/A error:我有以下产生#N/A 错误的公式:

=VLOOKUP(N8,Lookups!J5:L2772,3,FALSE)

The formula in N8 is: N8中的公式为:

=LEFT(M8,4)

And the value in N8 will be the first part of a UK postcode (eg N1, W1A, SW1Y, TF1, SO26) N8 中的值将是英国邮政编码的第一部分(例如 N1、W1A、SW1Y、TF1、SO26)

I've tried changing the vlookup to an index and match formula but cannot get that to work either.我试过将 vlookup 更改为索引和匹配公式,但也无法正常工作。

Any help is greatly appreciated.任何帮助是极大的赞赏。

Many thanks:)非常感谢:)

公式

价值观

邮政编码查找

Your formula returns 4 characters.您的公式返回 4 个字符。 =LEFT(M8,FIND(" ",M8)-1) will return the characters up to the first space (and excluding the space). =LEFT(M8,FIND(" ",M8)-1)将返回第一个空格(不包括空格)的字符。

TRIM(N8) would also remove trailing spaces, if you plan to keep your formula as it was.如果您打算保持公式不变, TRIM(N8)也会删除尾随空格。 In that case =VLOOKUP(TRIM(N8),Lookups:J5,L2772,3,FALSE) would also work, but this is less likely to throw an error:在那种情况下=VLOOKUP(TRIM(N8),Lookups:J5,L2772,3,FALSE)也可以工作,但这不太可能引发错误:

( =VLOOKUP(LEFT(M8,FIND(" ",M8)-1),'Lookups':J5,L2772,3,0) ) ( =VLOOKUP(LEFT(M8,FIND(" ",M8)-1),'Lookups':J5,L2772,3,0) )

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

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