问题
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