Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Steve
 
Posts: n/a
Default If then statement to search for text possible?

I was wondering if there is a way to write an if statement like this:

=if(a1="*HOU*", "Houston",0)

So that if the text in cell A1 contains "HOU" then it would return "Houston".

I know it works if the cell is an exact match, but what about if it only
contains the word???

HELP!

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.misc
Ken Wright
 
Posts: n/a
Default If then statement to search for text possible?

=IF(SEARCH("*HOU*",A3),"Houston",0)

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

------------------------------*------------------------------*----------------
It's easier to beg forgiveness than ask permission :-)
------------------------------*------------------------------*----------------


"Steve" wrote in message
...
I was wondering if there is a way to write an if statement like this:

=if(a1="*HOU*", "Houston",0)

So that if the text in cell A1 contains "HOU" then it would return
"Houston".

I know it works if the cell is an exact match, but what about if it only
contains the word???

HELP!

Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.misc
Ken Wright
 
Posts: n/a
Default If then statement to search for text possible?

Oops - my bad. Forgot to trap for when no match. Both the others gave you
the right steer though.

=IF(ISNUMBER(SEARCH("*HOU*",A1)),"Houston",0)

Apologies again.

Regards
Ken..................



"Ken Wright" wrote in message
...
=IF(SEARCH("*HOU*",A3),"Houston",0)

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

------------------------------*------------------------------*----------------
It's easier to beg forgiveness than ask permission :-)
------------------------------*------------------------------*----------------


"Steve" wrote in message
...
I was wondering if there is a way to write an if statement like this:

=if(a1="*HOU*", "Houston",0)

So that if the text in cell A1 contains "HOU" then it would return
"Houston".

I know it works if the cell is an exact match, but what about if it only
contains the word???

HELP!

Thanks!





  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default If then statement to search for text possible?

I bet you meant:
=if(countif(a3,"*hou*"),"houston",0)

Ken Wright wrote:

=IF(SEARCH("*HOU*",A3),"Houston",0)

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

------------------------------*------------------------------*----------------
It's easier to beg forgiveness than ask permission :-)
------------------------------*------------------------------*----------------

"Steve" wrote in message
...
I was wondering if there is a way to write an if statement like this:

=if(a1="*HOU*", "Houston",0)

So that if the text in cell A1 contains "HOU" then it would return
"Houston".

I know it works if the cell is an exact match, but what about if it only
contains the word???

HELP!

Thanks!


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
Ken Wright
 
Posts: n/a
Default If then statement to search for text possible?

Think I was braindead :-(

Cheers Dave

Regards
Ken...............

"Dave Peterson" wrote in message
...
I bet you meant:
=if(countif(a3,"*hou*"),"houston",0)

Ken Wright wrote:

=IF(SEARCH("*HOU*",A3),"Houston",0)

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

------------------------------*------------------------------*----------------
It's easier to beg forgiveness than ask permission :-)
------------------------------*------------------------------*----------------

"Steve" wrote in message
...
I was wondering if there is a way to write an if statement like this:

=if(a1="*HOU*", "Houston",0)

So that if the text in cell A1 contains "HOU" then it would return
"Houston".

I know it works if the cell is an exact match, but what about if it
only
contains the word???

HELP!

Thanks!


--

Dave Peterson





  #6   Report Post  
Posted to microsoft.public.excel.misc
Roger Govier
 
Posts: n/a
Default If then statement to search for text possible?

Hi Steve

You could use
=IF(ISNUMBER(FIND("HOU",A1)),"Houston",0)
if you are looking for only HOU and not Hou or hou.
If you don't want to be case sensitive, then use Search instead.
=IF(ISNUMBER(SEARCH("HOU",A1)),"Houston",0)
or
=IF(ISNUMBER(MATCH("HOU",A1)),"Houston",0)

--
Regards

Roger Govier


"Steve" wrote in message
...
I was wondering if there is a way to write an if statement like this:

=if(a1="*HOU*", "Houston",0)

So that if the text in cell A1 contains "HOU" then it would return
"Houston".

I know it works if the cell is an exact match, but what about if it
only
contains the word???

HELP!

Thanks!



  #7   Report Post  
Posted to microsoft.public.excel.misc
Domenic
 
Posts: n/a
Default If then statement to search for text possible?

Try...

=IF(ISNUMBER(SEARCH("HOU",A1)),"Houston",0)

If you want the formula to be case-sensitive, replace SEARCH with FIND.

Hope this helps!

In article ,
"Steve" wrote:

I was wondering if there is a way to write an if statement like this:

=if(a1="*HOU*", "Houston",0)

So that if the text in cell A1 contains "HOU" then it would return "Houston".

I know it works if the cell is an exact match, but what about if it only
contains the word???

HELP!

Thanks!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wildcard search functions within Vlookup Benn Excel Worksheet Functions 2 July 26th 05 01:12 PM
Do I need a sumif or sum of a vlookup formula? PeterB Excel Worksheet Functions 0 June 1st 05 12:23 PM
IF Statement Brent New Users to Excel 3 April 29th 05 04:24 PM
FAQ Spreadsheet with search function murphyz Excel Discussion (Misc queries) 0 March 19th 05 09:24 PM
Search for a specific character in a cell in an if statement mcl Excel Worksheet Functions 2 January 4th 05 09:14 PM


All times are GMT +1. The time now is 10:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"