Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default extract value from cell

I have following data:

1) In column A1 to A100 there are various addressess (which includes house
no., street name etc.)
2) In column C1 to C50 there are only Street Names.

Now, i want a function that extract Street Name from address column (A1 to
A100) and show in front of each cell. Street Names are to be match from
Street Names column (C1 to C50).

hope some one understand..thanks.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/201001/1

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default extract value from cell

One way...

Assume these are the addresses in the range A2:A8 -

111 2nd St
2 Golfview Dr
33 Long St
1455 Cherry St
45 Thorn Run Rd
299 Dead End Dr
100 Smithfield St

Assume these are the street names in the range H2:H5 -

Cherry
Golfview
Dead End
2nd

Enter this formula in B2 and copy down as needed:

=LOOKUP(1E100,SEARCH(H$2:H$5,A2),H$2:H$5)

--
Biff
Microsoft Excel MVP


"adeel via OfficeKB.com" <u32736@uwe wrote in message
news:a21c3d38c3f9f@uwe...
I have following data:

1) In column A1 to A100 there are various addressess (which includes
house
no., street name etc.)
2) In column C1 to C50 there are only Street Names.

Now, i want a function that extract Street Name from address column (A1 to
A100) and show in front of each cell. Street Names are to be match from
Street Names column (C1 to C50).

hope some one understand..thanks.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/201001/1



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default extract value from cell

The question doesn't make sense or at least not to me.

2) In column C1 to C50 there are only Street Names.


Now, i want a function that extract Street Name from address column (A1 to
A100)


You already have the street names in column C
--
Mike

When competing hypotheses are equal, adopt the hypothesis that introduces
the fewest assumptions while still sufficiently answering the question.
Occam''s razor (Abbrev)


"adeel via OfficeKB.com" wrote:

I have following data:

1) In column A1 to A100 there are various addressess (which includes house
no., street name etc.)
2) In column C1 to C50 there are only Street Names.

Now, i want a function that extract Street Name from address column (A1 to
A100) and show in front of each cell. Street Names are to be match from
Street Names column (C1 to C50).

hope some one understand..thanks.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/201001/1

.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,203
Default extract value from cell

It would be nice if there was some unique character at the end of the street
portion of your addresses in column A. We could do it with a built in
worksheet function easily then. For example, if the street portion always
ended with a comma (,) then this formula (for the entry in A1) would do it:
=LEFT(A1,FIND(",",A1)-1)

But I'm making an assumption that it's not that easy. I'm also assuming
that the street address is the very first part of the entries in column A, as
you stated. We can build a User Defined Function (UDF) to deal with this.

Copy the code below and put it into a regular code module in your workbook.
To do that, open the workbook, press [Alt]+[F11] to enter the Visual Basic
(VB) Editor and use Insert -- Module in it to get a new code module. Copy
the code and paste it into that module, close the VB Editor.
Now in cell B1, put this formula:
=GetStreetInformation(A1)
fill that formula down to A100 and you should see your addresses in column B.

NOTE: If you have entries in column C with similar street names, such as
Main Street
North Main Street
S. Main Street
then put them in order so that the common part is in the list after others
with similar names, as
North Main Street
S. Main Street
Main Street
otherwise the code will always find "Main Street" before even looking at
North Main Street or S. Main Street

OK, here's the code

Function GetStreetInformation(FullAddress As Range) As String
Dim streetList As Range
Dim anyStreet As Range
Dim testAddress As String

testAddress = FullAddress.Value
Set streetList = ActiveSheet.Range("C1:" & _
ActiveSheet.Range("C" & Rows.Count).End(xlUp).Address)
GetStreetInformation = "Street Not Listed"
For Each anyStreet In streetList
If InStr(testAddress, anyStreet) 0 Then
GetStreetInformation = Left(testAddress, _
InStr(testAddress, anyStreet) + Len(anyStreet))
Exit For
End If
Next
End Function





"adeel via OfficeKB.com" wrote:

I have following data:

1) In column A1 to A100 there are various addressess (which includes house
no., street name etc.)
2) In column C1 to C50 there are only Street Names.

Now, i want a function that extract Street Name from address column (A1 to
A100) and show in front of each cell. Street Names are to be match from
Street Names column (C1 to C50).

hope some one understand..thanks.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/201001/1

.

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
Extract Cell Comments and Paste as text in a cell Goaliemenace Excel Worksheet Functions 3 October 19th 09 10:28 PM
Extract Column Letter from Cell Reference in another Cell JKBEXCEL Excel Discussion (Misc queries) 2 December 29th 06 04:27 PM
Extract From Cell WDP Excel Worksheet Functions 4 December 15th 05 02:41 AM
how to extract data from a cell in a formula in another cell vidhya Excel Worksheet Functions 1 October 17th 05 04:31 PM
Extract Unique Values, Then Extract Again to Remove Suffixes Karl Burrows Excel Discussion (Misc queries) 23 June 25th 05 10:37 PM


All times are GMT +1. The time now is 07:29 PM.

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"