Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
=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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Wildcard search functions within Vlookup | Excel Worksheet Functions | |||
Do I need a sumif or sum of a vlookup formula? | Excel Worksheet Functions | |||
IF Statement | New Users to Excel | |||
FAQ Spreadsheet with search function | Excel Discussion (Misc queries) | |||
Search for a specific character in a cell in an if statement | Excel Worksheet Functions |