#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default Parsing address info

I have address information obtained from a 3rd party. All information for a
particular adress is contained in a single cell with no delimiters between
address1 address 2 suburb state and postal code. I can't use fixed width in
text to columns as all components of the address are different character
lengths.

Anyone got any suggestions?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 527
Default Parsing address info

Mike

This is the best I can think of for the moment.

Sub t()
Dim rsp, c, sep As String, sp 'As String
Dim p As Integer, q As Integer
rsp = InputBox("Enter the Number of words before the separator", "Insert
commas in text", 3, 100, 100)

For Each c In Selection
Count = 0
For i = 1 To Len(c)
sp = Mid(c, i, 1)
If sp = " " Then
Count = Count + 1
If CCur(Count) = CCur(rsp) Then
c.Value = Application.WorksheetFunction.Substitute(c, sp, ", ", rsp)
End If
End If
Next i
Next
End Sub

Copy code into a vb module, select the addresses and run the code as many
times as you need.

The code will insert a comma into the 3rd space (after the third word by
default). You will have to re-run the code as often as it takes and be
careful that the data selected needs a coma after the same word on the line
above.

Try spliting up the data into like groups before running the code.

Regards
Peter
"Mike" wrote:

I have address information obtained from a 3rd party. All information for a
particular adress is contained in a single cell with no delimiters between
address1 address 2 suburb state and postal code. I can't use fixed width in
text to columns as all components of the address are different character
lengths.

Anyone got any suggestions?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 527
Default Parsing address info

Mike

Then you can use text to columns

Peter

"Mike" wrote:

I have address information obtained from a 3rd party. All information for a
particular adress is contained in a single cell with no delimiters between
address1 address 2 suburb state and postal code. I can't use fixed width in
text to columns as all components of the address are different character
lengths.

Anyone got any suggestions?

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
How do I manipulate a string to collect the address from it? Eddie Excel Discussion (Misc queries) 1 November 3rd 06 12:44 AM
how can i convert an email address to a web address Arvind Sikar Excel Worksheet Functions 3 October 3rd 06 08:06 PM
Hyperlink Address and SubAddress not concatenating correctly EagleOne Excel Discussion (Misc queries) 0 September 11th 06 03:49 PM
Formular to add to a IP address Sean Excel Discussion (Misc queries) 5 September 9th 06 06:47 AM
MIN Function w/ variable address reference WLMPilot Excel Worksheet Functions 7 June 10th 05 07:56 PM


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