The Search function returns the location of a string, not whether the string exists. So, what you want to do is surround the code with iserror. Iserror returns true if there's an error or false if there's not.
=IF(iserror(SEARCH("BAC*",E7)),VLOOKUP(K7,Fees,2,0),VLOOKUP(K7,Fees,3,0))
This code will search for BAC, if it finds it then it will go to the false part of the formula:
If it doesn't find it, then it will go to the true part of the if statement:
You can take it a step farther by searching for "abc", then you would do this:
=IF(iserror(SEARCH("BAC*",E7)),if(iserror(SEARCH("ABC*",E7),"Code for not ABC or BAC",VLOOKUP(K7,Fees,2,0)),VLOOKUP(K7,Fees,3,0))
Bookmarks