Return True or false value if string is found in range

Prevost

Board Regular
Joined
Jan 23, 2014
Messages
198
Hi There,
I am wondering if there is a function in excel that would return true or false when searching for a string segment. I am currently using the below code to evaluate my search, which seems to be working, but I was just wondering if anyone knew of anything else out there?
Thanks!

Code:
If InStr(1, ActiveCell.Value, "My String") <> 0 Then
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
This will work...

Code:
If WorksheetFunction.CountIf(Range("[COLOR=#008000][B]A1:F100[/B][/COLOR]"), "[COLOR=#FF0000][B]*[/B][/COLOR]My String[COLOR=#FF0000][B]*[/B][/COLOR]") Then
Replace the green text with the address for the range you want to search and note the two required asterisks (needed if you are not going to match all the text in a cell) highlighted in red on either side of text being searched for.
 
Upvote 0

Forum statistics

Threads
1,216,143
Messages
6,129,110
Members
449,486
Latest member
malcolmlyle

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top