+ Reply to Thread
Results 1 to 3 of 3

Extracting Substring from Column of Data

  1. #1
    Registered User
    Join Date
    08-16-2011
    Location
    Fontana, CA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Extracting Substring from Column of Data

    Hi Everyone,

    First of all, you guys are all awesome. I've learned a lot just from searching other stuff.

    I do some computational biophysics research but am having trouble with some of the data processing because I need bits of information that are nestled inside large strings of text.

    Here's an example of what my data might start out looking like:
    \1

    What I want are those "gi" numbers. The number begins after "gi|" and ends with "|".

    However, part of the trouble I've found is that there are many | elsewhere in the string and the gi numbers can have variable length so that I can't just use mid and select out a certain number of characters after each "gi|".

    Here's what I would hope to get as an output:
    \1

    I've attached a workbook that has three sheets (one with 10 rows of real data, and then the other two are simply the example dummy input and dummy output shown above). If I wasn't clear let me know.

    As a note, my real data can have as many as several thousand rows of results so I don't know if that means I should be using a macro or if a worksheet function is still practical.

    Thanks a ton if anyone is able to figure this out! The scientific world will benefit from your contribution
    Attached Files Attached Files

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Extracting Substring from Column of Data

    Here is a macro that will find all numbers you are looking for in a new sheet named Sheet1 that you have to create manually. You can also change the name of this sheet in the macro if you like.

    Copy this code to a procedure in your workbook. Create the sheet Sheet1 and run it.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-16-2011
    Location
    Fontana, CA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Extracting Substring from Column of Data

    Quote Originally Posted by p24leclerc View Post
    Here is a macro that will find all numbers you are looking for in a new sheet named Sheet1 that you have to create manually. You can also change the name of this sheet in the macro if you like.

    Copy this code to a procedure in your workbook. Create the sheet Sheet1 and run it.

    Please Login or Register  to view this content.
    What a gem!! Thanks so much.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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