+ Reply to Thread
Results 1 to 4 of 4

Excel 2007 : Extract text from string

  1. #1
    Registered User
    Join Date
    05-13-2010
    Location
    Cleveland, OH
    MS-Off Ver
    Excel 2007
    Posts
    5

    Extract text from string

    Good Afternoon,

    I'm working on a project involving large amounts of data. I've attached a sample of the raw data.

    Here is a brief description of what I am trying to accomplish.

    In sheet 1, Column A I have raw data, formatted as follows:
    Rank Artist,[artist 2] Venue.

    In sheet 2 Column A, I have a list of venues.

    This data set spans over 6000 such entries. I am looking for a way to extract the Venue name from Sheet 1 Column A and place it into Column B, by matching it up with the venues listed in Sheet 2.

    Additionally, I would also like to extract the rank and the artist. Because the data is not uniform all around, I can't easily parse the data. If an error occurs, I just want to leave it blank so that I can edit it manually.

    Any help you could provide would be greatly appreciated!

    Thank you!
    Attached Files Attached Files
    Last edited by AmericanJesus; 05-13-2010 at 03:33 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Extract text from string

    I couldn't think of any simple way to get your column B values, but I tweaked a macro I had to do it for you.
    Please Login or Register  to view this content.

    How/Where to install the macro:

    1. Open up your workbook
    2. Get into VB Editor (Press Alt+F11)
    3. Insert a new module (Insert > Module)
    4. Copy and Paste in your code (given above)
    5. Get out of VBA (Press Alt+Q)
    6. Save as a macro-enabled workbook

    The macro is installed and ready to use. Press Alt-F8 and select GetVenues from the macro list.
    Attached Files Attached Files
    Last edited by JBeaucaire; 05-13-2010 at 03:22 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    05-13-2010
    Location
    Cleveland, OH
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Extract text from string

    JBeaucaire,

    That is perfect! Thank you so much for your assistance, this saves me a couple days worth of work.

  4. #4
    Valued Forum Contributor
    Join Date
    02-08-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2007
    Posts
    122

    Re: Extract text from string

    Try this,

    For Venue in B1
    =LOOKUP(9.99E+307,SEARCH(Sheet2!$A$1:$A$579,A1),Sheet2!$A$1:$A$579)

    For Ranking in C1
    =LEFT(A1,FIND(" ",A1)-1)*1

    For Artist's name in D1
    =TRIM(SUBSTITUTE(SUBSTITUTE(A1,B1,""),C1,""))

    You will have to fix the #N/A manually.

    Regards

+ 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