Need simple formula to find one string in another

E

Eric_NY

I need a formula which returns Y if a cell contains a string and N if not.

Here's a start: IF(FIND("XXX",C3),"Y","N"). But the trouble is that if the
target string is not found, it returns a #VALUE! error.

I can of course fix that by something like
IF(ISERROR(FIND("XXX",C3),"N","Y"). But this seems unnecessarily awkward. Is
there a simpler solution?

I'm using Excel 2003.

Thanks.
 
T

T. Valko

Is there a simpler solution?

It depends on ones definition of "simpler".

You can try this if you're not trying to match the case of "XXX".

=IF(COUNTIF(C3,"*XXX*"),"Y","N")

FIND is case sensitive. Using FIND:

xXx does not match XXX.

Using COUNTIF, case doesn't matter.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top