Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EXCEL -Using Wildcards in If Then statements 2

Status
Not open for further replies.

jen9814

Technical User
Nov 5, 2002
35
US
I am trying to find a certain word in a cell using an if then statement. I would like to find if the cell contains "yes" anywhere in the cell and if it does to name the cell "yes". I would appreciate any help. Thanks.
 
Hi,

Do you REALLY mean that you want to NAME the cell "YES"

UNLESS...

there is ONLY ONE CELL containing that string???

Only ONE range on a sheet can have a specific name like "Yes"

???



Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
try the SEARCH function. You should be able to look its use up in Excel Help.
 
Try the IF function that follows to determine whether a cell has the consecutive letters "yes" in it, but you can't assign a range name to it without doing so manually or incorporating that action into a macro.

=IF(ISERR(FIND("yes",E2)),"","yes")

This function either leaves the current cell with a null string (appearing blank) or with the text string "yes".
 
Thank you very much for the help. The function =IF(ISERR(FIND("yes",E2)),"","yes")worked great!
 
I spoke too soon that the function worked. Unfortunately it only works when yes is first word in the cell or if it is exactly "yes". Sometimes the word yes is in various locations in the cell and sometimes has a "-" or other characters attached to the word. I am just trying to do this with one column. Any suggestions?
 
sorry but nope - the find function doesn't work like that - just tested the formula on a bunch of different examples and worked on all of them. That formula will return a yes if any 3 characters in the cell show yes.

Tested and works for
aera c yes sdfasefa
\serfyesasetr
a\dsr\ yes-werte
yes
a\f yes

amongst others

Rgds, Geoff
[blue]Si hoc signum legere potes, operis boni in rebus Latinus alacribus et fructuosis potiri potes![/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
 
Agree that the function does work with the examples listed above but for some reason it doesn't work with these examples.

Yes - Pivot
Yes-Pivot
 
It's because they have a capital Y
change formula to:
=IF(ISERR(FIND("YES",upper(E2))),"","yes")

Rgds, Geoff
[blue]Si hoc signum legere potes, operis boni in rebus Latinus alacribus et fructuosis potiri potes![/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
 
If you use SEARCH instead of FIND, you don't need to worry about tests being case sensitive.

Glenn.
 
The formula =IF(ISERR(FIND("YES",upper(E2))),"","yes") and using SEARCH worked great. Thank all of you for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top