Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 231
Default Deleting duplicate house numbers

Hello,

we extract information for street addresses, sometimes we receive house
number duplicated example:

123 123 Main Street

Does anyone know of a way to delete the first number so we just have the
correct address of 123 Main Street?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,522
Default Deleting duplicate house numbers

Sub dupstreetnumbersinstring()
lr = Cells(Rows.Count, "a").End(xlUp).Row
For Each c In Range("a1:a" & lr)
x = InStr(c, " ")
If Left(c, x) = Mid(c, x + 1, x) Then
MsgBox c.Row
c.Value = Mid(c, x + 1, 999999999)
End If
Next c
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Sarah" wrote in message
...
Hello,

we extract information for street addresses, sometimes we receive house
number duplicated example:

123 123 Main Street

Does anyone know of a way to delete the first number so we just have the
correct address of 123 Main Street?

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Deleting duplicate house numbers

With the addresses in column A, try this small macro:

Sub FixAddress()
Set rr = Intersect(ActiveSheet.UsedRange, Range("A:A"))
For Each r In rr
parts = Split(r.Value, " ")
If IsNumeric(parts(0)) And parts(0) = parts(1) Then
parts(0) = ""
r.Value = Trim(Join(parts, " "))
End If
Next
End Sub

Macros are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To use the macro from the normal Excel window:

1. ALT-F8
2. Select the macro
3. Touch Run



To remove the macro:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm


--
Gary''s Student - gsnu201001


"Sarah" wrote:

Hello,

we extract information for street addresses, sometimes we receive house
number duplicated example:

123 123 Main Street

Does anyone know of a way to delete the first number so we just have the
correct address of 123 Main Street?

Thanks

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 look for duplicate house addresses in a column in Excel? Kevin S Excel Worksheet Functions 3 June 19th 07 09:15 PM
Deleting duplicate row RN Excel Discussion (Misc queries) 7 April 20th 07 09:05 AM
Deleting Duplicate Numbers In A Column: How ? Robert11 New Users to Excel 1 September 26th 06 01:15 PM
Removing house numbers from addresses dalymjl Excel Worksheet Functions 3 April 24th 05 08:00 AM
Deleting BOTH duplicate entries Julian Excel Discussion (Misc queries) 2 March 7th 05 11:54 PM


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