+ Reply to Thread
Results 1 to 15 of 15

Formula to remove 2nd word from a string of text

  1. #1
    Registered User
    Join Date
    09-24-2010
    Location
    bikramksingh
    MS-Off Ver
    Excel 2007
    Posts
    13

    Question Formula to remove 2nd word from a string of text

    Hi,

    I need a formula that could help me remove 2nd, 3rd or 4th word from a string of text. Suppose the text is "DRBS 88V XRD Database Management System"

    I want a formula that could remove 88V from the cell and keep the rest: "DRBS XRD Database Management System"

    Similarly the formula should work to remove 3rd word XRD to keep the rest: "DRBS XRD Database Management System"

    I am not very fluent with Excel, so need your help.

    Thanks
    Last edited by bikramksingh; 09-25-2010 at 09:57 PM.

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Need Formula to remove 2nd word from a string of text

    Hi
    you have posted in the wrong forum. i will move it for you.
    Please read our rules before proceeding

  3. #3
    Forum Contributor
    Join Date
    12-02-2004
    Location
    London
    Posts
    255

    Re: Need Formula to remove 2nd word from a string of text

    If your original piece of text is in cell A2, then in B2 enter:-

    =SUBSTITUTE(A2,MID(A2,FIND(" ",A2,1)+1,FIND(" ",A2,FIND(" ",A2,1)+1)-FIND(" ",A2,1)),"")

    The above formula will remove the 88V from DRBS 88V XRD Database Management System, then in cell C2 enter:-

    =SUBSTITUTE(B2,MID(B2,FIND(" ",B2,1)+1,FIND(" ",B2,FIND(" ",B2,1)+1)-FIND(" ",B2,1)),"")

    This will give you DRBS Database Management System

    Then in D2 enter:-

    =SUBSTITUTE(C2,MID(C2,FIND(" ",C2,1)+1,FIND(" ",C2,FIND(" ",C2,1)+1)-FIND(" ",C2,1)),"")

    This will leave you with:-

    DRBS Management System

  4. #4
    Registered User
    Join Date
    09-24-2010
    Location
    bikramksingh
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Need Formula to remove 2nd word from a string of text

    Quote Originally Posted by Gary Brown View Post
    If your original piece of text is in cell A2, then in B2 enter:-

    =SUBSTITUTE(A2,MID(A2,FIND(" ",A2,1)+1,FIND(" ",A2,FIND(" ",A2,1)+1)-FIND(" ",A2,1)),"")
    Thanks a lot.

    I will do as you suggested. Could you please suggest me what part of the above formula, i should tweak, if I need to remove 3rd word and not the second one, as suggested in the above formula.

    Actually i need to remove 3rd words separately, and even 4th word ...

    I want the following output from the sentence " "DRBS 88V XRD Database Management System"

    "DRBS XRD Database Management System" (removing 2nd word)

    "DRBS 88V Database Management System" (removing 3rd word)

    "DRBS 88V XRD Management System" (removing 4th word)

    "DRBS 88V XRD Database System" (removing 5th word)

    I am new to excel, so will not be able to make sense of it without knowing which part to tweak,

    Thanks again

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Need Formula to remove 2nd word from a string of text

    Look this:
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    09-24-2010
    Location
    bikramksingh
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Need Formula to remove 2nd word from a string of text

    Quote Originally Posted by zbor View Post
    Look this:
    Thanks for the formula, but it does the same thing - remove 2nd word. what about 3rd, 4th and so on?

    I liked the previous formula because it was not too lengthy. Please help me by giving the formula to remove 3rd word using either your or aforementioned formula then I can make head and tail of the formula

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Need Formula to remove 2nd word from a string of text

    Try:

    =TRIM(SUBSTITUTE($A1,TRIM(MID(SUBSTITUTE($A1," ",REPT(" ",100)),1+(100*(COLUMNS($A$1:A$1)-1)),100)),""))

    copied across columns, each consecutive column will have the next word in the original phrase removed.

    the COLUMNS($A$1:A$1) is the "counter". You can replace with a hard coded or specific cell reference containing a number if you want only one cell to adjust according to the word you want removed.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  8. #8
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Need Formula to remove 2nd word from a string of text

    Try a shorter formula with a single number change to remove the kth word.
    If you want to remove the second word from the text in cell A1 use:
    Please Login or Register  to view this content.
    I owe the above to DonkeyOte who showed us how to do it.
    Last edited by MarvinP; 09-24-2010 at 11:57 PM.

  9. #9
    Registered User
    Join Date
    09-24-2010
    Location
    bikramksingh
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Need Formula to remove 2nd word from a string of text

    Quote Originally Posted by MarvinP View Post
    Try a shorter formula with a single number change to remove the kth word.
    If you want to remove the second word from the text in cell A1 use:
    Please Login or Register  to view this content.
    I owe the above to DonkeyOte who showed us how to do it.
    Thanks a lot for this formula. This worked.

    The above formula work as a charm when i am removing 2nd, 3rd, and 4th word from beginning.


    I was wondering will this formula work if i want to remove 2nd, 3rd or 4th words from the end of the string? A string could be 3 word long or 12 or 32 word long.

  10. #10
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Need Formula to remove 2nd word from a string of text

    Quote Originally Posted by bikramksingh View Post
    Thanks for the formula, but it does the same thing - remove 2nd word. what about 3rd, 4th and so on?
    Instead of number 2 enter number 1,2,3,4... or any other positive number in the box.

    But glad you find solution....

  11. #11
    Registered User
    Join Date
    09-24-2010
    Location
    bikramksingh
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Need Formula to remove 2nd word from a string of text

    Quote Originally Posted by zbor View Post
    Instead of number 2 enter number 1,2,3,4... or any other positive number in the box.

    But glad you find solution....
    Thaks a lot. Now I have 2 and 3 different way to achieve this result..


    I was wondering will the formula you suggested work if i want to remove 2nd, 3rd or 4th words from the end of the string?

    A string could be 3 word long or 12 or 32 word long, so i cannot say remove 7th word if i want to remove second last word in a 8-word string, nor i can say remove 6th word in 8-word long string, if i want to remove 3rd word from the end.

    Will this formula help?

  12. #12
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Formula to remove 2nd word from a string of text

    Why don't you try it

    Example removing words from the beggining...

    So if you need to remove 2nd string from the end of 8 words you must enter 6.

  13. #13
    Registered User
    Join Date
    09-24-2010
    Location
    bikramksingh
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Formula to remove 2nd word from a string of text

    Hi,

    I have tried it, and I understand that if we have a sentence with a fixed number of words in each cell then this works, but what if i do not know the length of the sentence (or each cell has a sentence each of varied lengths) and still i need to remove 2nd or 3rd or 4th word from the end?

  14. #14
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Formula to remove 2nd word from a string of text

    Try tweaking like this.....

    This removes 3rd word from the end

    =TRIM(REPLACE(SUBSTITUTE(A1," ",REPT(" ",LEN(A1))),(1+LEN(A1)-LEN(SUBSTITUTE(A1," ",""))-3)*LEN(A1)+1,LEN(A1),""))

    change 3 as required
    Audere est facere

  15. #15
    Registered User
    Join Date
    09-24-2010
    Location
    bikramksingh
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Formula to remove 2nd word from a string of text

    Thanks a lot. This worked.

    You all have been very helpful

+ 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