# Excel IF and SEARCH function combination



## MarieColo

I am trying to do the following:

If cell A1 contains the characters "ABC" anywhere in the string or value, then "Y", else "N". I almost have it by using =if((search("ABC",A1)),"Y","N"). However, with the "else" if "ABC" is not found, it returns #VALUE! as opposed to "N".

Any assistance you can provide, would be greatly appreciate! Thanks. -m


----------



## Glaswegian

Hi and welcome to TSF.

Try

*=IF(ISNUMBER(SEARCH("abc",A1,1)),"Y","N")*

ISNUMBER checks the type of value and returns TRUE or FALSE. The #VALUE error refers to the fact that Excel could not translate the value to the type required.


----------



## MarieColo

Thanks, a million!! -m


----------

