#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 82
Default find text in cell

Hi,

I am trying to do something like this:

if(instr("ABC",A1),A1,""))

Doesn't work? If ABC is found in A1 I would like to copy A1 to B1 (leave B1
blank if not).

Thanks in advance for any help you can give.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default find text in cell

Did you bother to look in the vba help index for INSTR

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Bonnie" wrote in message
...
Hi,

I am trying to do something like this:

if(instr("ABC",A1),A1,""))

Doesn't work? If ABC is found in A1 I would like to copy A1 to B1 (leave
B1
blank if not).

Thanks in advance for any help you can give.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default find text in cell

Instr is a VBA function.

You can use =search() or =find():

=if(isnumber(search("abc",a1),a1,"")

=find() is case sensitive.
=search() is not.

Another alternative (not case sensitive):

=if(countif(a1,"*abc*")0,a1,"")



Bonnie wrote:

Hi,

I am trying to do something like this:

if(instr("ABC",A1),A1,""))

Doesn't work? If ABC is found in A1 I would like to copy A1 to B1 (leave B1
blank if not).

Thanks in advance for any help you can give.


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 82
Default find text in cell

That's what I was looking for Dave. Thanks so much for your kindness in
taking the time.

Bonnie


"Dave Peterson" wrote:

Instr is a VBA function.

You can use =search() or =find():

=if(isnumber(search("abc",a1),a1,"")

=find() is case sensitive.
=search() is not.

Another alternative (not case sensitive):

=if(countif(a1,"*abc*")0,a1,"")



Bonnie wrote:

Hi,

I am trying to do something like this:

if(instr("ABC",A1),A1,""))

Doesn't work? If ABC is found in A1 I would like to copy A1 to B1 (leave B1
blank if not).

Thanks in advance for any help you can give.


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
FIND / SEARCH text compare cell to string in 3rd cell nastech Excel Discussion (Misc queries) 0 October 29th 07 02:51 AM
find cell with matching text, then reference cell in same row [email protected] Excel Worksheet Functions 2 October 20th 07 01:05 AM
Find text in a cell and copy text to another cell Shaun Excel Discussion (Misc queries) 6 July 4th 07 05:25 PM
find text in cell and replace it with part of the text in that ce. jules Excel Discussion (Misc queries) 3 May 3rd 07 10:18 AM
Find text within cell then display text to left Jambruins Excel Discussion (Misc queries) 5 April 17th 06 10:01 PM


All times are GMT +1. The time now is 08:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"