Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Dave R.
 
Posts: n/a
Default Return text found in a search

I have column with data like:

A1: 123 Main St. San Francisco
A2: 5654 Moon Hollow Way Oakland

I have over 10 thousand of these. My goal is to pull the city out, but since
the city is in different places (and after x y or z number of spaces, etc.)
I cannot seem to do it with a simple text formula.

and I have another list of cities only like:

C1: San Bernadino
C2: Oakland
C3: San Francisco

My question is -- can I do a formula, say in B1, that would search through
my list in C1:C2 within A1, and return the found match?

In other words the result would be:

A1: 123 Main St. San Francisco
B1: San Francisco

(e.g. it found that "San Francisco" was contained within A1, and returned
the match from the list of cities in C1:C3)

Any ideas?


  #2   Report Post  
N Harkawat
 
Posts: n/a
Default

Name your city list as a named range say citylst (using Insert, name
define..)

then use this formula on cell B1 and copy all the way down.
=INDEX(citylst,MATCH(1,COUNTIF(A1,"*"&citylst&"*") ,0))
Array entered(ctrl+shift+enter)

It will pull the name of that city that is in the cell



"Dave R." wrote in message
...
I have column with data like:

A1: 123 Main St. San Francisco
A2: 5654 Moon Hollow Way Oakland

I have over 10 thousand of these. My goal is to pull the city out, but
since
the city is in different places (and after x y or z number of spaces,
etc.)
I cannot seem to do it with a simple text formula.

and I have another list of cities only like:

C1: San Bernadino
C2: Oakland
C3: San Francisco

My question is -- can I do a formula, say in B1, that would search through
my list in C1:C2 within A1, and return the found match?

In other words the result would be:

A1: 123 Main St. San Francisco
B1: San Francisco

(e.g. it found that "San Francisco" was contained within A1, and returned
the match from the list of cities in C1:C3)

Any ideas?




  #3   Report Post  
Domenic
 
Posts: n/a
Default

Try...

B1, copied down:

=INDEX($C$1:$C$3,MATCH(TRUE,ISNUMBER(SEARCH($C$1:$ C$3,A1)),0))

....confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!

In article ,
"Dave R." wrote:

I have column with data like:

A1: 123 Main St. San Francisco
A2: 5654 Moon Hollow Way Oakland

I have over 10 thousand of these. My goal is to pull the city out, but since
the city is in different places (and after x y or z number of spaces, etc.)
I cannot seem to do it with a simple text formula.

and I have another list of cities only like:

C1: San Bernadino
C2: Oakland
C3: San Francisco

My question is -- can I do a formula, say in B1, that would search through
my list in C1:C2 within A1, and return the found match?

In other words the result would be:

A1: 123 Main St. San Francisco
B1: San Francisco

(e.g. it found that "San Francisco" was contained within A1, and returned
the match from the list of cities in C1:C3)

Any ideas?

  #4   Report Post  
Dave R.
 
Posts: n/a
Default

Thanks Domenic and Norman! They both work great.


"Domenic" wrote in message
...
Try...

B1, copied down:

=INDEX($C$1:$C$3,MATCH(TRUE,ISNUMBER(SEARCH($C$1:$ C$3,A1)),0))

...confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!

In article ,
"Dave R." wrote:

I have column with data like:

A1: 123 Main St. San Francisco
A2: 5654 Moon Hollow Way Oakland

I have over 10 thousand of these. My goal is to pull the city out, but

since
the city is in different places (and after x y or z number of spaces,

etc.)
I cannot seem to do it with a simple text formula.

and I have another list of cities only like:

C1: San Bernadino
C2: Oakland
C3: San Francisco

My question is -- can I do a formula, say in B1, that would search

through
my list in C1:C2 within A1, and return the found match?

In other words the result would be:

A1: 123 Main St. San Francisco
B1: San Francisco

(e.g. it found that "San Francisco" was contained within A1, and

returned
the match from the list of cities in C1:C3)

Any ideas?



  #5   Report Post  
Dave R.
 
Posts: n/a
Default

Hmm, I'm not sure why I think or thought your name is Norman, I haven't been
here in awhile. I think I was thinking of Norman Harker.

Thanks anyway :)


"N Harkawat" wrote in message
...
Name your city list as a named range say citylst (using Insert, name
define..)

then use this formula on cell B1 and copy all the way down.
=INDEX(citylst,MATCH(1,COUNTIF(A1,"*"&citylst&"*") ,0))
Array entered(ctrl+shift+enter)

It will pull the name of that city that is in the cell



"Dave R." wrote in message
...
I have column with data like:

A1: 123 Main St. San Francisco
A2: 5654 Moon Hollow Way Oakland

I have over 10 thousand of these. My goal is to pull the city out, but
since
the city is in different places (and after x y or z number of spaces,
etc.)
I cannot seem to do it with a simple text formula.

and I have another list of cities only like:

C1: San Bernadino
C2: Oakland
C3: San Francisco

My question is -- can I do a formula, say in B1, that would search

through
my list in C1:C2 within A1, and return the found match?

In other words the result would be:

A1: 123 Main St. San Francisco
B1: San Francisco

(e.g. it found that "San Francisco" was contained within A1, and

returned
the match from the list of cities in C1:C3)

Any ideas?






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
Lookup returns #NA when search value (text) has leading zeros. M-Dickey Excel Worksheet Functions 1 May 10th 05 10:26 PM
How to insert carriage return in the middle of a text formula to . Dave Excel Discussion (Misc queries) 2 March 17th 05 02:14 PM
How do I search for text within text? Dave Bailey Excel Discussion (Misc queries) 1 March 17th 05 08:19 AM
How can I make Excel return the text in column A only if there is. phatbusa Excel Worksheet Functions 1 January 26th 05 04:25 PM
search multiple worksheets for an item and return the Wsheets name Chris Excel Worksheet Functions 16 November 7th 04 12:15 PM


All times are GMT +1. The time now is 09:31 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"