+ Reply to Thread
Results 1 to 6 of 6

extracting a string between 2 characters

  1. #1
    Registered User
    Join Date
    02-14-2021
    Location
    USA
    MS-Off Ver
    2010
    Posts
    2

    extracting a string between 2 characters

    Some time ago I was able to write the below line of code.

    Please Login or Register  to view this content.
    which helped me pull the "XXXXXXXXXXXXXXXXXXXXX" from the below line of text (located in a text file)
    3) GS1 : (XXXXXXXXXXXXXXXXXXXXX)

    now I have a different text file, with similar data, but with a different text structure that I need to pull the same string from.

    the line of text I need to pull from is below:

    04:06:57.450| SendIOS |XXXXXXXXXXXXXXXXXXXXX| 00000| X134| | 077| | | 07| 1| 4| | Del_Day_Ind| 3

    I need to modify the line of code above, to still give me the XXXXXXXXXXXXXXXXXXXXX as the result. keeping in mind the rest of the macro is already setup to run through the entire text file and uses the line of code above to extract the XXXXXXXXXXXXXXXXXXXXX each time and enter it in a cell.

    I'm no excel genius, but I've dabbled many times, and can usually modify the macro to fit my needs...but this one is making a fool of me.

    here is the entire macro, in case that would be of assistance
    Please Login or Register  to view this content.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2505
    Posts
    27,235

    Re: extracting a string between 2 characters

    This expression will return the third element in your string. In your example it is XXXXXXXXXXXXXXXXXXXXX. I assuming you want that because it is the third one.

    Please Login or Register  to view this content.
    BTW the expression you are using for the first one seems rather complicated for the task at hand. I would try:
    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,301

    Re: extracting a string between 2 characters

    Quote Originally Posted by tefuzz View Post
    ... 3) GS1 : (XXXXXXXXXXXXXXXXXXXXX) ...
    Has anything changed in relation to this previous topic (?):

    https://www.excelforum.com/excel-pro...-document.html

    or is it the same topic ?

  4. #4
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: extracting a string between 2 characters

    Attaching a simple text file can help us help you better. As I understand it:

    Please Login or Register  to view this content.

  5. #5
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,861

    Re: extracting a string between 2 characters

    Cross-posted at: http://www.vbaexpress.com/forum/show...a-line-of-text
    Please read Excel Forum's Cross-Posting policy in rule 8: http://www.excelforum.com/forum-rule...rum-rules.html
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2505
    Posts
    27,235

    Re: extracting a string between 2 characters

    Per macropod's note:

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not provided the required cross-post link(s) here.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important.

    macropod provided the link for you. Please review our rules.

+ 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. Extracting name from string of characters
    By Yonex1975 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-02-2021, 01:37 PM
  2. [SOLVED] extracting characters from string
    By amirflax in forum Excel General
    Replies: 6
    Last Post: 05-17-2020, 01:36 AM
  3. Extracting characters from a text string - please help
    By bookharin in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-23-2015, 10:51 AM
  4. [SOLVED] extracting 1st 4 characters from a string
    By braintrain in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-18-2014, 01:48 AM
  5. removing/extracting characters from a string
    By The Monitor in forum Excel General
    Replies: 1
    Last Post: 11-30-2011, 06:19 PM
  6. extracting characters from string
    By johnmerlino in forum Excel General
    Replies: 6
    Last Post: 10-21-2010, 09:56 AM
  7. Extracting characters from a string
    By incognito in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-30-2007, 03:18 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