+ Reply to Thread
Results 1 to 5 of 5

Replace Text in a String

  1. #1
    Forum Contributor
    Join Date
    06-16-2008
    Posts
    115

    Replace Text in a String

    I'm trying to figure out if this will work in Excel. I need to replace 1 word in a string of text, however, I need to insert different words. So Control +H will not work for me.

    Here's the string of text: We sell gear for all fans

    That string is pasted into about 1500 cells in Column A. I need to replace the word "gear" with a more descriptive phrase based on the type of sport. So for hockey, it should be "hockey gear" and for football it should be "football gear" etc...

    Column A has the string of text; Column B has the replacement phrases. How do I accomplish this in Excel?

    Thanks in advance.

  2. #2
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097

    Re: Reploace Text in a String

    Hi,

    If in column B you have B1= Hockey Gear and B2= Football Gear then in C1

    =LEFT(A1,FIND("gear",A1)-1)&B1&RIGHT(A1,FIND("gear",A1)+4) copied down
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  3. #3
    Forum Contributor
    Join Date
    06-16-2008
    Posts
    115

    Re: Replace Text in a String

    Hey man, tanks a lot. It works nicely. I'm trying to deconstruct the formula... wondering how to make it work with longer or shorter text strings?

  4. #4
    Forum Contributor
    Join Date
    03-19-2010
    Location
    singapore
    MS-Off Ver
    Excel 2019
    Posts
    179

    Re: Replace Text in a String

    very difficult to understand, can anyone attach a example excel file here?

    thanks

  5. #5
    Valued Forum Contributor mdbct's Avatar
    Join Date
    11-11-2005
    Location
    CT
    MS-Off Ver
    2003 & 2007
    Posts
    848

    Re: Replace Text in a String

    You can also use the SUBSTITUTE function for this:
    A1>We sell gear for all fans
    B1> Football gear
    C1>=SUBSTITUTE(A1,"gear",B1)

+ 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