简体   繁体   中英

vlookup error when lookup value cell has been populated with formula

I have the following formula which is producing a #N/A error:

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

The formula in N8 is:

=LEFT(M8,4)

And the value in N8 will be the first part of a UK postcode (eg N1, W1A, SW1Y, TF1, SO26)

I've tried changing the vlookup to an index and match formula but cannot get that to work either.

Any help is greatly appreciated.

Many thanks:)

公式

价值观

邮政编码查找

Your formula returns 4 characters. =LEFT(M8,FIND(" ",M8)-1) will return the characters up to the first space (and excluding the space).

TRIM(N8) would also remove trailing spaces, if you plan to keep your formula as it was. In that case =VLOOKUP(TRIM(N8),Lookups:J5,L2772,3,FALSE) would also work, but this is less likely to throw an error:

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

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