If CONTAINS

K

Kel

Hi all!!!

Im trying to figure how in a "IF formula" you do the following,
Also i would like to have it for VB.
Thanx

IF(A1 CONTAINS (beetween other words) jump,TRUE,FALSE

say A1 contains text like this "i like to jump to the roof" or "to the roof
i lilke to jump" not in a particular position, return cell B1 to say "NO"

Thank you all.
 
D

Dave O

The syntax is
=IF(SEARCH("jump",A1,1)>0,TRUE,FALSE)

In VBA the code is
If InStr(1, Range("a1").Value, "jump") > 0 Then
 
R

Ron Rosenfeld

Hi all!!!

Im trying to figure how in a "IF formula" you do the following,
Also i would like to have it for VB.
Thanx

IF(A1 CONTAINS (beetween other words) jump,TRUE,FALSE

say A1 contains text like this "i like to jump to the roof" or "to the roof
i lilke to jump" not in a particular position, return cell B1 to say "NO"

Thank you all.

In Excel, you would use the FIND or SEARCH worksheet functions and, if the
#Value! error is returned, then the search string was not found.

In VBA you would use the InStr Function


--ron
 
D

Dave Peterson

=if(isnumber(search("jump",a1)),true,false)

or even:
=isnumber(search("jump",a1))
 
Top