+ Reply to Thread
Results 1 to 9 of 9

Replacing specific text in string from same column...

  1. #1
    Registered User
    Join Date
    05-18-2014
    MS-Off Ver
    Excel 2003
    Posts
    9

    Unhappy Replacing specific text in string from same column...

    Dear All,/

    I want to replace specific text with same text in a column. for example in column A having text STM1-1-3-4-1-3-6-3,
    STM4-1-2-1-1-3-1-2, STM64-1-6-1-35-3-5-2 in row.
    I want to replace STM1-1- / STM4-1- /STM64-1- with "S" and rest text will remain same. This values required in column B. So in cloumn B values will be
    S3-4-1-3-6-3, S2-1-1-3-1-2, S6-1-35-3-5-2.

    I am trying with substitute function but not able to figure out how to use that with IF function.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,704

    Re: Replacing specific text in string from same column...

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    05-18-2014
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Replacing specific text in string from same column...

    Pl find attached excel sheet as requested. I have mentioned Before and After on Tab.
    Attached Files Attached Files

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: Replacing specific text in string from same column...

    In the After sheet, the cells contain text which is not in the before sheet. Anyways, if your text string is in B2, try this

    Please Login or Register  to view this content.
    Or this..
    Please Login or Register  to view this content.
    Is this what you are trying to achieve?
    Last edited by sktneer; 06-05-2014 at 02:15 AM.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  5. #5
    Registered User
    Join Date
    05-18-2014
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Replacing specific text in string from same column...

    Hi, need to replace STM1-1- /STM4-1- /STM16-1- /STM64-1- with "S" in all the columns. There I am facing problem. for rest conversion of text string I am using "SUBSTITUTE" function.
    =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(B2,"-","-J",2),"-","-K",3),"-","",4),"-","",4)

  6. #6
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: Replacing specific text in string from same column...

    Try this....
    Please Login or Register  to view this content.
    So if the string in B2 is STM1-1-3-4-1-3-6-3, the formula will convert this to S3-4-1-3-6-3.
    In your substitute formula, instead of using B2 as a reference, use this formula in place of B2 i.e. where ever there is B2 in your Substitute formula replace it with REPLACE(B2,2,FIND("*",SUBSTITUTE(B2,"-","*",2))-1,"").

    Does this help?

  7. #7
    Registered User
    Join Date
    05-18-2014
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Replacing specific text in string from same column...

    Thanks a Lot buddy ... Its working ...

  8. #8
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: Replacing specific text in string from same column...

    Glad I could help. Thanks for the feedback.
    If that takes care of your question, please mark your thread as solved by selecting Thread Tools (just above your first post) --> Mark thread as solved.
    Moreover you may also click on * (star) to Add Reputation to those who have put their time and efforts to help you in this forum. This is another way to say thanks to them.

  9. #9
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,937

    Re: Replacing specific text in string from same column...

    See the attachement
    Attached Files Attached Files

+ 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. [SOLVED] Extracting specific part of the text string to another column
    By ssanjju in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 01-20-2013, 07:20 PM
  2. [SOLVED] Find Specific Text in Text String and Return Value in Adjacent Column
    By watchouse in forum Excel General
    Replies: 2
    Last Post: 07-11-2012, 03:53 PM
  3. Replacing certain characters in a text string
    By skatmandu2002 in forum Excel General
    Replies: 1
    Last Post: 06-16-2008, 09:00 AM
  4. Replacing a string within a text file
    By DHallam in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-20-2005, 01:05 AM
  5. Formula for Replacing Text in a String?
    By David Godinger in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-16-2005, 10:06 AM

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