ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   IF - looking in a cell for a specific value (https://www.excelbanter.com/excel-worksheet-functions/167965-if-looking-cell-specific-value.html)

Sarah (OGI)

IF - looking in a cell for a specific value
 
In an IF statement, what do I need to write to say that if cell A1 contains
"fred", (i.e. " * fred * ") then.. "Yes".
(I'm not sure what operator is needed to say 'contains')

Any ideas?

Mike H

IF - looking in a cell for a specific value
 
Perhaps


=IF(ISERROR(SEARCH("Fred",A1)),"Not there","There")

Mike


"Sarah (OGI)" wrote:

In an IF statement, what do I need to write to say that if cell A1 contains
"fred", (i.e. " * fred * ") then.. "Yes".
(I'm not sure what operator is needed to say 'contains')

Any ideas?


Ken Johnson

IF - looking in a cell for a specific value
 
On Nov 30, 10:15 pm, Sarah (OGI)
wrote:
In an IF statement, what do I need to write to say that if cell A1 contains
"fred", (i.e. " * fred * ") then.. "Yes".
(I'm not sure what operator is needed to say 'contains')

Any ideas?


=IF(COUNTIF(A1,"*fred*")0,"Yes","No")

Ken Johnson

Frederik[_3_]

IF - looking in a cell for a specific value
 
Try is with

=IF(SEARCH("fred";A1)0;"YES";"NO")

greetz


"Sarah (OGI)" schreef in bericht
...
In an IF statement, what do I need to write to say that if cell A1
contains
"fred", (i.e. " * fred * ") then.. "Yes".
(I'm not sure what operator is needed to say 'contains')

Any ideas?




Niek Otten

IF - looking in a cell for a specific value
 
=IF(NOT(ISERROR(FIND("fred",A2))),"Yes","No")

or

=IF(ISERROR(FIND("fred",A1)),"No","Yes")

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Sarah (OGI)" wrote in message ...
| In an IF statement, what do I need to write to say that if cell A1 contains
| "fred", (i.e. " * fred * ") then.. "Yes".
| (I'm not sure what operator is needed to say 'contains')
|
| Any ideas?




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

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