+ Reply to Thread
Results 1 to 3 of 3

Replacing directionals at the end of street addresesses

  1. #1
    Registered User
    Join Date
    05-13-2019
    Location
    Virginia, USA
    MS-Off Ver
    2016
    Posts
    7

    Replacing directionals at the end of street addresesses

    Hey,

    I am trying to find and replace the direction in street addresses (Se, Ne, Nw, Sw) with the capitalized version of them after they have been propered (=proper(X)). This is easy if they are in the middle (below), but I don't know how to make it correct ones at the end of an address, ex 1234 Main St Se, since it doesn't have a space after it. These are in full street addresses and some with have " Se", ex Seasons Drive, in them so I can't do it that way.

    Please Login or Register  to view this content.
    Is there a way to make VBA look for the end of the cell? So instead of the 2nd space, it would look for that. Like " Ne[end of cell]"

    Thank you!

  2. #2
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Replacing directionals at the end of street addresesses

    For i = 1 To Cells(Rows.Count, "F").End(xlUp).Row
    Range("F" & i).Value = Left(Range("F" & i).Value, Len(Range("F" & i).Value) - 2) & " " & UCase(Right(Range("F" & i).Value, 2))
    Next i
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Replacing directionals at the end of street addresesses

    You can add a space to the end for the function, then trim the results.

    This seems like a workable approach. Also, we're only going to read the data once, then write it out to the sheet once at the end:

    Please Login or Register  to view this content.
    This way it's nearly instantaneous, even if there were a million rows.
    Last edited by JBeaucaire; 01-17-2020 at 11:52 AM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replacing Abbreviations in Street Addresses
    By stcanary in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 03-12-2022, 11:33 AM
  2. [SOLVED] Separating street number from street name
    By john.ghaly in forum Excel General
    Replies: 10
    Last Post: 07-15-2015, 10:11 PM
  3. [SOLVED] Trying to separate street number and street name into columns
    By greenmat in forum Excel General
    Replies: 7
    Last Post: 07-27-2012, 04:24 PM
  4. Replacing Abbreviations in Street Addresses
    By belltt in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-31-2012, 07:58 PM
  5. separate street address and street number
    By iwanttoplaywii in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-24-2011, 09:45 PM
  6. how do I convert cell 'Street,#' to '# Street' these are addresse
    By Closing hyperlinked wookbooks upon exit in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-30-2006, 06:23 AM
  7. [SOLVED] How do I sort a column of street number/street name by the stree.
    By JHoleman1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-07-2005, 09:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1