ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do I perform a contains function for a specific cell? (https://www.excelbanter.com/excel-worksheet-functions/28506-how-do-i-perform-contains-function-specific-cell.html)

Vstein

How do I perform a contains function for a specific cell?
 
I am wanting to do an if statement. If cell A contains "a certain word" then
Y else N. what is the syntax for the the contains portain of the if
statement?

Aladin Akyurek

Vstein wrote:
I am wanting to do an if statement. If cell A contains "a certain word" then
Y else N. what is the syntax for the the contains portain of the if
statement?


Some example idioms...

=ISNUMBER(SEARCH(" "&E2&" "," "&A2&" "))+0

=ISNUMBER(FIND(" "&E2&" "," "&A2&" "))+0

=COUNTIF(A2,"*"&E2&"*")

Custom format the formula cell as:

[=0]"N";[=1]"Y"

KL

Hi,

Try these:

case sensitive
=IF(ISERROR(FIND("YourString",A1)),"No","Yes")
=IF(SUBSTITUTE(A1,"YourString","")=A1,"No","Yes")

not case sensitive:
=IF(COUNTIF(A1,"*YourString*"),"Yes","No")
=IF(ISERROR(SEARCH("YourString",A1)),"No","Yes")

Regards,
KL



"Vstein" wrote in message
...
I am wanting to do an if statement. If cell A contains "a certain word"
then
Y else N. what is the syntax for the the contains portain of the if
statement?





All times are GMT +1. The time now is 12:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com