+ Reply to Thread
Results 1 to 6 of 6

SUBSTITUTE with "" if find one of the words in a cell

  1. #1
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Kuching, SARAWAK
    MS-Off Ver
    Excel 2010
    Posts
    116

    SUBSTITUTE with "" if find one of the words in a cell

    Hello Experts,

    I want to strip off the below words if found any in bunch of words in a cell:-

    1. bin
    2. binti
    3. bte
    4. b.
    5. bt.

    input samples:

    1. Marina binti Kamarudin
    2. Kamal b. Mohd. Rusli
    3. Sh. Hamidah bte Abg. Mokhtar
    4. Mohd Firdaus bin Abdullah
    5. Siti Nurul Nazihah bt. Md. Abd. Zaidel

    expected output:-

    1. Marina Kamarudin
    2. Kamal Mohd. Rusli
    3. Sh. Hamidah Abg. Mokhtar
    4. Mohd Firdaus Abdullah
    5. Siti Nurul Nazihah Md. Abd. Zaidel

    I found this syntax SUBSTITUTE able to do this but only for one criteria only. I don't know how to improvise the formulas to be able to check multiple criterias and replace it with empty space if met one of them.

    =SUBSTITUTE(text,find,replace)

    sample : =SUBSTITUTE(A1,"binti ","") ==> assuming the text is in column A.

    i tried to change it to =SUBSTITUTE(A1,{"binti ","bin ","bte ","bt. ","b."},"") , assuming that the curley bracket would be for multiple criterias with OR operator but I got an #ERROR! as a result.

    Appreciate if anyone could share solution on this.

    Thanks a lot.

    DZ

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: SUBSTITUTE with "" if find one of the words in a cell

    No, you need to just keep adding SUB to your formula
    =substitute(SUBSTITUTE(A1,"binti ",""),"bin")...........................
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: SUBSTITUTE with "" if find one of the words in a cell

    This will work when the replacement text is single.

    Data Range
    A
    B
    C
    1
    bin
    Marina binti Kamarudin
    Marina Kamarudin
    2
    binti
    Kamal b. Mohd. Rusli
    Kamal Mohd. Rusli
    3
    bte
    Sh. Hamidah bte Abg. Mokhtar
    Sh. Hamidah Abg. Mokhtar
    4
    b.
    Mohd Firdaus bin Abdullah
    Mohd Firdaus Abdullah
    5
    bt.
    Siti Nurul Nazihah bt. Md. Abd. Zaidel
    Siti Nurul Nazihah Md. Abd. Zaidel

    Data Range
    C
    1
    =SUBSTITUTE(B1,LOOKUP(2,1/SEARCH(" "&$A$1:$A$5&" ",B1),$A$1:$A$5),"")


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,373

    Re: SUBSTITUTE with "" if find one of the words in a cell

    Try :

    =SUBSTITUTE(A1,LOOKUP(2*15,SEARCH($J$2:$J$6,SUBSTITUTE(SUBSTITUTE(A1,",","")," ","")),$J$2:$J$6),"")
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Kuching, SARAWAK
    MS-Off Ver
    Excel 2010
    Posts
    116

    Re: SUBSTITUTE with "" if find one of the words in a cell

    Woww! Thanks so much for everyone's solution.

    I have tried each and each works like a charm! Really appreciate it so much!

    Best Regards,
    DZ

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: SUBSTITUTE with "" if find one of the words in a cell

    Thanks for the feedback.

+ 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. How to Substitute "11" with "11th" without ending up with "11th11th"?
    By bcianni in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-21-2019, 03:20 PM
  2. [SOLVED] Indirect "Substitute(Substitute(" not working for multiple spaces
    By Ochimus in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-03-2018, 04:01 PM
  3. [SOLVED] Help on "IF", "FIND", "SUBSTITUTE", & "LEFT/RIGHT" FUNCTIONS
    By pooja135 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 02-20-2018, 03:56 PM
  4. Replies: 2
    Last Post: 07-24-2017, 02:19 AM
  5. [SOLVED] How to insert + sign in front of every word =Substitute(A3," "," +")
    By inayet in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-16-2013, 09:41 PM
  6. Using "Find" to return results if a word is found within multiple words in a cell
    By pylauzier in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-01-2011, 01:37 PM
  7. Replies: 5
    Last Post: 06-26-2006, 09:23 PM

Tags for this Thread

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