+ Reply to Thread
Results 1 to 6 of 6

Need a find and replace formula

  1. #1
    Registered User
    Join Date
    01-19-2009
    Location
    MA
    MS-Off Ver
    Excel 2000
    Posts
    1

    Need a find and replace formula

    I'm having problems getting excel to do exactly what I need.
    Ive got a demo column (shown below) that needs the values ST and S replaced with STREET, and the one currently with STREET to remain untouched.

    Please Login or Register  to view this content.
    I've tried find and replace, and =SUBSTITUTE(A1;" S";" STREET")
    But you can see why these won't work. The best example is "S. South St" where it will replace South with S. Streetouth Street. I somehow need to look for a string that has no characters following it. Any suggestions?

    Thanks!

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492
    If these are in column A, in B1 try this and copy down:

    =IF(RIGHT(A1,2)=" S",LEFT(A1,LEN(A1)-2)&" STREET",IF(RIGHT(A1,3)=" ST",LEFT(A1,LEN(A1)-3)&" STREET",A1))
    _________________
    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!)

  3. #3
    Forum Contributor
    Join Date
    03-22-2006
    Location
    UK
    MS-Off Ver
    Office 2013
    Posts
    275

    Alternative Solution

    Try this as an alternative:

    Please Login or Register  to view this content.
    Assuming your text values are in Column A, put this in B1 and copy down; otherwise adjust to suit your data.

    HTH ...spellbound

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492
    Quote Originally Posted by Spellbound View Post
    Try this as an alternative:

    Please Login or Register  to view this content.
    Assuming your text values are in Column A, put this in B1 and copy down; otherwise adjust to suit your data.

    HTH ...spellbound
    That's pretty slick, but one has to assume the addresses will include Drive and Road and Lane...that formula replaces every last string with Street.

  5. #5
    Forum Contributor
    Join Date
    03-22-2006
    Location
    UK
    MS-Off Ver
    Office 2013
    Posts
    275

    JBeaucaire

    Point taken, I just assumed it was to be used with STREET as this was the examples given.

    Came across this solution whilst looking for a reverse formula to build up addressess from multiple columns with commas. Was trying to solve this myself before creating a post.

    Incidentally, when I experimented with your formula, it did not work with the second example, which still came out as SMITH STREE not SMITH STREET.

    Will have to do some more work on both of these to see if it works for me.

    spellbound

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492
    Correct. the OP asked specifically for a solution to the ST and S at the end. I presumed that meant NOT to solve for any other situations.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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