View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Zone[_3_] Zone[_3_] is offline
external usenet poster
 
Posts: 373
Default Using "IF" with a "NAME" search?

Jo, if you're talking about VBA,
If instr(k2,"John")0 then
or, to make sure you don't get parts of longer words like Johnson, include a
trailing space
If instr(k,2,"John ")0 then
Capitalization could matter. Check VBA help for Instr.
HTH, James

"Jo" wrote in message
ups.com...
Hi,

Say I have a "Name" column which could have someone name like "John
Davis" or "Adam John Nelson"

Now, I want to use "IF" statement so that any name has the word "John"
be considered. For example, using the above example I want to get the
answer like this:

John Davis
Adam John Nelson

Using a statment liks this: If(K2="John", "1","0") wouldn't work
right! Help please....

Thanks,
Jo