Using SQL "IN" Function in Excel

You could use MATCH :

=MATCH(A1, {"word1","word2","word3","word4","word5"}, 0) 

which will return the index of the matching item in the array list. The trailing 0 means it should be an exact match. It will return #N/A if it isn't there, so you can tag a IF(ISNA( onto the front to make it behave like your "IN":

=IF(ISNA(MATCH(A1, {"word1","word2","word3","word4","word5"}, 0)),"NO","YES")

Note the change in order of the "YES" and "NO"


=IF(OR(A1={"word1","word2","word3","word4","word5"}),"YES","NO")

Tags:

Excel