Adding a period to abbreviations in address column

rutt

New Member
Joined
Feb 13, 2007
Messages
6
I would like to a a period to abbreviations for Road(Rd.), Street(St.), Highway(Hwy.), Lane(Ln.) etc. in the address column in excel. Address column is Column F Row 2. Let me know if you need any other information. Thank you!
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Here is a VBA solution.

Code:
Option Explicit


Sub addPeriod()
    Dim lr As Long, i As Long
    lr = Range("F" & Rows.Count).End(xlUp).Row
    Application.ScreenUpdating = False
    For i = 2 To lr
        Range("F" & i) = Range("F" & i) & "."
    Next i
    Application.ScreenUpdating = True
    MsgBox "Action Completed"
End Sub
 
Upvote 0
Alan,

To clarify, that adds a period to the end of every value in column F, so that assumes that every entry in column F ends with an abbreviation.
So, that won't work if the abbreviated value isn't the last thing in the address (i.e. "1 Main St, New York, NY 11111"), or if the last thing isn't an abbreviation (i.e. "Road", "Street", "Apt. 4", etc.).

I think we probably need to see a whole bunch of examples of exactly what this data looks like, or else we are just making a bunch of assumptions.
 
Upvote 0
Maybe...

Before Macro

[TABLE="class: grid"]
<tbody>[TR]
[TD="bgcolor: #DCE6F1"][/TD]
[TD="bgcolor: #DCE6F1"]
F
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
1
[/TD]
[TD]
Text​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
2
[/TD]
[TD]
Road(Rd)​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
3
[/TD]
[TD]
Street(St)​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
4
[/TD]
[TD]
Highway(Hwy)​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
5
[/TD]
[TD]
Lane(Ln)​
[/TD]
[/TR]
</tbody>[/TABLE]


Code:
Sub aTest()
    Dim lastRow As Long
    
    lastRow = Cells(Rows.Count, "F").End(xlUp).Row
    With Range("F2:F" & lastRow)
        .Value = Evaluate("=IF(ROW(2:" & lastRow & "),SUBSTITUTE(" & .Address & ","")"","".)""))")
    End With
End Sub

After macro

[TABLE="class: grid"]
<tbody>[TR]
[TD="bgcolor: #DCE6F1"][/TD]
[TD="bgcolor: #DCE6F1"]
F
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
1
[/TD]
[TD]
Text​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
2
[/TD]
[TD]
Road(Rd.)​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
3
[/TD]
[TD]
Street(St.)​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
4
[/TD]
[TD]
Highway(Hwy.)​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
5
[/TD]
[TD]
Lane(Ln.)​
[/TD]
[/TR]
</tbody>[/TABLE]


M.
 
Upvote 0
Sorry, totally ignorant to this stuff! Is VBA different than entering a formula into the formula bar? I think I could sort the columns so that the address's with extensions would be together and only do those ones. Address's are in the following format:

11421 Route 322
350 Meadow Rd
416 N Pickering St
201 N Jefferson St
Po Box 174

Does this help?
 
Upvote 0
You need to step back, and really think about ALL the possibilities that might be dealing with.
In your examples, you already have 2 options which do not end in an abbreviation.
Might you also have some where the abbreviation occurs in the middle of the word? Like an apartment number appears after it, i.e.
416 N Pickering St, Apt 2B

Depending on the complexity of your data, you may possibly have to create a table (or array) that houses all the abbreviations that you are looking for.
 
Upvote 0
Sorry, totally ignorant to this stuff! Is VBA different than entering a formula into the formula bar? I think I could sort the columns so that the address's with extensions would be together and only do those ones. Address's are in the following format:

11421 Route 322
350 Meadow Rd
416 N Pickering St
201 N Jefferson St
Po Box 174

Does this help?

Disregard my post (#4)

M.
 
Upvote 0
I do have all of the Apt. in a secondary column, but it sounds like it would be easier to just do it by hand.
 
Upvote 0
Thanks for the help!! The forum has helped me with many other questions and I really appreciate all of the input!
 
Upvote 0
You could use Find/Replace All to replace all of each situation at once (I would recommend putting a space for the abbreviation, so you do not pick up words that have that letter combination in the middle of a word), but you need to be very careful of the following situations:
- If you replace " Rd" with " Rd.", if there is a value that was already " Rd." to start with, it will end up being " Rd.."
- If you have words like " State" or other words starting with " St", then replacing " St" with " St." would cause " State" to become " St.ate"

As you can see, data clean-up can be quite messy. Nothing beats getting good data from the start!
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,971
Members
452,371
Latest member
Frana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top