Compare the strings

Y

yangyh

I want to check if the string contains a particular word, say, string
"World" doesn't
have "ed". What the operator shall I use here? Thanks.

David
 
B

BenjieLop

yangyh said:
I want to check if the string contains a particular word, say, string
"World" doesn't
have "ed". What the operator shall I use here? Thanks.

David

Try this ...

=ISERROR(SEARCH(\"ED\",A1))

where A1 contains the string that you want to search.

Regards.
 
Y

yangyh

Thank you. I could not find the SEARCH function in VBA help.
Could you tell me the syntex? Thanks.

David
 
J

Juan Pablo González

In VBA you can use the InStr function, like

If InStr(1, TheString, "World") > 0 Then
MsgBox "The string exists in there"
End If
 
Top