Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Nir Nir is offline
external usenet poster
 
Posts: 36
Default find string within other string

I need to find multiply strings within ONE string
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default find string within other string

Look at DataText To Columns

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Nir" wrote in message
...
I need to find multiply strings within ONE string



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,355
Default find string within other string

Have you considered the SEARCH function?

"Nir" wrote:

I need to find multiply strings within ONE string

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Nir Nir is offline
external usenet poster
 
Posts: 36
Default find string within other string

I tried both Search and Find but the problem is the I have few options for
the strint to search and these functions don not approve "OR" function.

In other words I want to find "AA" Or "BB" Or "CC" within String "DFAA GTY".
Expected result would be "AA"

"Barb Reinhardt" wrote:

Have you considered the SEARCH function?

"Nir" wrote:

I need to find multiply strings within ONE string

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Nir Nir is offline
external usenet poster
 
Posts: 36
Default find string within other string

Bob
Please elaborate as i tried that one too.
"Bob Phillips" wrote:

Look at DataText To Columns

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Nir" wrote in message
...
I need to find multiply strings within ONE string






  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 733
Default find string within other string

Nir wrote...
I tried both Search and Find but the problem is the I have few options for
the strint to search and these functions don not approve "OR" function.


They do, but it's tricky.

In other words I want to find "AA" Or "BB" Or "CC" within String "DFAA GTY".
Expected result would be "AA"


With "DFAA GTY" in a cell named x,

=MID(x,LOOKUP(1E6,SEARCH({"AA","BB","CC"},x)),2)

would return "AA". If your strings could have multiple instances of any
of these, this particular formula would return the left most instance
of CC first, then the leftmost instance of BB, and finally the leftmost
instance of AA. If you want to return AA before BB and BB before CC,
use

=MID(x,LOOKUP(1E6,SEARCH({"CC","BB","AA"},x)),2)

If there are no instances of AA, BB or CC in x, the formula returns
#N/A.

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Nir Nir is offline
external usenet poster
 
Posts: 36
Default find string within other string

Harlan thanks,
it is almost perfect with one exception. The strings i am looking for
contain various lengths. can you help me out with that too.


"Harlan Grove" wrote:

Nir wrote...
I tried both Search and Find but the problem is the I have few options for
the strint to search and these functions don not approve "OR" function.


They do, but it's tricky.

In other words I want to find "AA" Or "BB" Or "CC" within String "DFAA GTY".
Expected result would be "AA"


With "DFAA GTY" in a cell named x,

=MID(x,LOOKUP(1E6,SEARCH({"AA","BB","CC"},x)),2)

would return "AA". If your strings could have multiple instances of any
of these, this particular formula would return the left most instance
of CC first, then the leftmost instance of BB, and finally the leftmost
instance of AA. If you want to return AA before BB and BB before CC,
use

=MID(x,LOOKUP(1E6,SEARCH({"CC","BB","AA"},x)),2)

If there are no instances of AA, BB or CC in x, the formula returns
#N/A.


  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 733
Default find string within other string

Nir wrote...
it is almost perfect with one exception. The strings i am looking for
contain various lengths. can you help me out with that too.


Always best to provide representative samples, e.g., looking for AAA,
BB or C in some string x in that order (return AAA first, then BB and
finally C).

=LOOKUP(1000000,SEARCH({"C","BB","AAA"},x),{"C","B B","AAA"})

  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Nir Nir is offline
external usenet poster
 
Posts: 36
Default find string within other string

thanks Harlan it works.
for that reason i placed a rephrased question in the forum + e.g.
thanks again


"Harlan Grove" wrote:

Nir wrote...
it is almost perfect with one exception. The strings i am looking for
contain various lengths. can you help me out with that too.


Always best to provide representative samples, e.g., looking for AAA,
BB or C in some string x in that order (return AAA first, then BB and
finally C).

=LOOKUP(1000000,SEARCH({"C","BB","AAA"},x),{"C","B B","AAA"})


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
Hyperlinks in Excel Littlecleavesy Excel Worksheet Functions 1 October 19th 06 09:07 PM
find nth position of a string TUNGANA KURMA RAJU Excel Discussion (Misc queries) 6 October 18th 05 01:25 PM
Find first numeric value in text string Rbp9ad Excel Worksheet Functions 4 October 15th 05 02:01 AM
Excel - Find & Replace text in a string bklim Excel Worksheet Functions 1 June 14th 05 06:42 AM
How to find if a string starts with a digit galsaba Excel Worksheet Functions 1 March 4th 05 06:01 PM


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

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

About Us

"It's about Microsoft Excel"