View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Vik[_3_] Vik[_3_] is offline
external usenet poster
 
Posts: 8
Default check if a cell contains a substring

Mike,

On the web I have found 2 solutions -
Solution 1:
Using the COUNTIF function in the following IF statement:
=IF(COUNTIF(A2,""*""&B2&""*"")0,""Found"",""Not Found"")

Solution 2:
Using the ISNUMBER and FIND functions, as follows:
=IF(ISNUMBER(FIND(B2,A2)),""Found"",""Not Found"")

I tried to follow, but I cannot figure out the syntax -

tmp = Evaluate(CountIf(A2, "*exc*") 0, "Found", "Not Found")

Should I put the formula into some cell and evaluate it?

Thanks

"Mike Fogleman" wrote in message
...
Check out this link for a formula:
http://www.exceltip.com/st/Finding_a...tring/874.html

If you want to do this from VBA using a formula, see VBHelp on "Evaluate"

Mike F
"Vik" wrote in message
...
Hi All,

I am new in Excel programming.
I need to check if a cell contains a substring, something like

"*excel*".

First, I tried

Set d = .Find(cdnName, LookIn:=xlValues, LookAt:=xlPart,

MatchCase:=False)

Only it looks like .Find cannot be used more than once. I have a nested
loop
and used .Find in a wrapper loop.

I need some alternative to .Find.

Thanks!