+ Reply to Thread
Results 1 to 6 of 6

Extract 2nd word from a string - varying length, between colons

  1. #1
    Registered User
    Join Date
    09-11-2012
    Location
    Vienna, austria
    MS-Off Ver
    Excel 2010
    Posts
    3

    Extract 2nd word from a string - varying length, between colons

    Hi

    am a "new" user.

    How do I extract the 2nd word from a cell that has varying length and is between colons eg.

    eggs:flowers::beans44e
    balls:trees::sprouts456gt, etc?

    Your help is much appreciated.

  2. #2
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Extract 2nd word from a string - varying length, between colons

    With your data in A1:
    =TRIM(MID(SUBSTITUTE(A$1,":",REPT(" ",999)),(2)*999-998,999))
    Gary's Student

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,726

    Re: Extract 2nd word from a string - varying length, between colons

    Here's one way, with your string in A1:

    =RIGHT(LEFT(A1,SEARCH("::",A1)-1),LEN(LEFT(A1,SEARCH("::",A1)-1))-SEARCH(":",A1))

    Hope this helps.

    Pete

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Extract 2nd word from a string - varying length, between colons

    Try this. If the text is in A1, put the formula in B1 -
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  5. #5
    Registered User
    Join Date
    09-11-2012
    Location
    Vienna, austria
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Extract 2nd word from a string - varying length, between colons

    Thank you very much it is working!!

  6. #6
    Registered User
    Join Date
    09-11-2012
    Location
    Vienna, austria
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Extract 2nd word from a string - varying length, between colons

    Hi, can I put this in as an Add-Ins because I have to do this every month. If yes, how do I do it?

    Thanks in advance.

+ 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