ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Compare the strings (https://www.excelbanter.com/excel-discussion-misc-queries/44297-compare-strings.html)

yangyh

Compare the strings
 

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


--
yangyh
------------------------------------------------------------------------
yangyh's Profile: http://www.excelforum.com/member.php...o&userid=26883
View this thread: http://www.excelforum.com/showthread...hreadid=465743


BenjieLop


yangyh Wrote:
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.


--
BenjieLop


------------------------------------------------------------------------
BenjieLop's Profile: http://www.excelforum.com/member.php...o&userid=11019
View this thread: http://www.excelforum.com/showthread...hreadid=465743


yangyh


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

David


--
yangyh
------------------------------------------------------------------------
yangyh's Profile: http://www.excelforum.com/member.php...o&userid=26883
View this thread: http://www.excelforum.com/showthread...hreadid=465743


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

--
Regards,

Juan Pablo González
Excel MVP
"yangyh" wrote in
message ...

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

David


--
yangyh
------------------------------------------------------------------------
yangyh's Profile:
http://www.excelforum.com/member.php...o&userid=26883
View this thread: http://www.excelforum.com/showthread...hreadid=465743





All times are GMT +1. The time now is 08:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com