#1   Report Post  
Posted to microsoft.public.excel.misc
Harley
 
Posts: n/a
Default * in IF statement

How do I include * in an IF statement? For example, how do I write
=IF(A1="*abc*","in there", "not there") when "abc" is contained anywhere in
the string in cell A1?

TIA
  #2   Report Post  
Posted to microsoft.public.excel.misc
Ron Coderre
 
Posts: n/a
Default * in IF statement

Try one of these:

=IF(ISNUMBER(SEARCH("abc",A1)),"in there","not there")
or
=IF(COUNTIF(A1,"*abc*"),"in there","not there")

Does that help?

***********
Regards,
Ron

XL2002, WinXP-Pro


"Harley" wrote:

How do I include * in an IF statement? For example, how do I write
=IF(A1="*abc*","in there", "not there") when "abc" is contained anywhere in
the string in cell A1?

TIA

  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default * in IF statement

=if(isnumber(search("abc",a1)),"yep","nope")

=search() is case sensitive.
=find() is not.

alternatively:

=if(countif(a1,"*abc*")0, "yep", "nope")

(not case sensitive)

Harley wrote:

How do I include * in an IF statement? For example, how do I write
=IF(A1="*abc*","in there", "not there") when "abc" is contained anywhere in
the string in cell A1?

TIA


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
ewan7279
 
Posts: n/a
Default * in IF statement

Hi Harley,

Try =IF(ISERROR(FIND("abc",A1,1)),"NOT THERE","THERE")

Ewan

"Harley" wrote:

How do I include * in an IF statement? For example, how do I write
=IF(A1="*abc*","in there", "not there") when "abc" is contained anywhere in
the string in cell A1?

TIA

  #5   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default * in IF statement

=find() IS case sensitive
=search() IS NOT.

(and =countif() is not case sensitive)

Dohhh.

Dave Peterson wrote:

=if(isnumber(search("abc",a1)),"yep","nope")

=search() is case sensitive.
=find() is not.

alternatively:

=if(countif(a1,"*abc*")0, "yep", "nope")

(not case sensitive)

Harley wrote:

How do I include * in an IF statement? For example, how do I write
=IF(A1="*abc*","in there", "not there") when "abc" is contained anywhere in
the string in cell A1?

TIA


--

Dave Peterson


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
Harley
 
Posts: n/a
Default * in IF statement

Thank you Ron and Ewan, all the formulas worked.

"ewan7279" wrote:

Hi Harley,

Try =IF(ISERROR(FIND("abc",A1,1)),"NOT THERE","THERE")

Ewan

"Harley" wrote:

How do I include * in an IF statement? For example, how do I write
=IF(A1="*abc*","in there", "not there") when "abc" is contained anywhere in
the string in cell A1?

TIA

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
Returning Specific Cell Content using IF Statement weeclaire Excel Discussion (Misc queries) 2 February 17th 06 01:48 PM
SET statement tutorial Daminc Excel Discussion (Misc queries) 13 January 17th 06 04:47 PM
If statement Matt Montagliano Excel Discussion (Misc queries) 1 September 8th 05 08:47 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


All times are GMT +1. The time now is 04:49 AM.

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

About Us

"It's about Microsoft Excel"