Vlookup returns #N/A if string contains a '

独自空忆成欢 提交于 2021-02-05 06:55:06

问题


I am using a vlookup statement: =VLOOKUP(B1232,Sheet1!A:B,2,0). The cell in B1232 contains the string:

'You Rawk!!~'

With the "'" inside the string that I want to go and find, the program retursn #N/A. I believe that the Vlookup command is omitting the opening single-quote when it runs the search, is that true? Is there any way to work around this so that I can run the VLOOKUP?


回答1:


I don't think the quote is the problem - Excel uses "~" [tilde] as an "escape character" so it has a problem with values that contain "~". You can use a SUBSTITUTE function within your VLOOKUP to replace "~" with "~~" - when using two tildes the first one tells excel to treat the second as a literal "~", i.e. use

=VLOOKUP(SUBSTITUTE(B1232,"~","~~"),Sheet1!A:B,2,0)

That will work whether B1232 contains "~" or not



来源:https://stackoverflow.com/questions/18993099/vlookup-returns-n-a-if-string-contains-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!