+ Reply to Thread
Results 1 to 9 of 9

Macro to Parse String

  1. #1
    Registered User
    Join Date
    01-15-2013
    Location
    DC
    MS-Off Ver
    Excel 2007
    Posts
    7

    Exclamation Macro to Parse String

    Hello, I REALLY need help soon! I have an Inventory Excel Spredsheet where i need to parse the data in a column. I need to create a Macro to do this. I have to parse this data into 'First Name' , and 'Last Name' (I ONLY NEED THE NAMES, all other data is irrelevant) and does not have to be parsed but my data does not only contain names so i just can't just parse where there is a space or colon. If there is a "Jr' or 'II' or any other name after the last name, it should be grouped with the 'Last Name', all other data (room numbers) after the last name can be in a seperate column. My data looks similar to this:

    Column A
    ND
    ND
    Assigned: Jim Scott Jr - Rm 279
    Assigned: Joe M Smith - Rm 990
    ND
    ND
    Stored: Room 432
    Extra: Room 123
    Assigned: Tony Tone II - Rm 356
    Assigned: Susie Q Young -Rm 394
    Stored: Room 563
    Stored: Room 789
    Extra: Room 654
    ND
    Assigned: Jimmy Joe Jr - Rm 276


    Please let me know if you need any questions answered! I am on a tight deadline so any start will help! Thanks so much in adavnce!
    Last edited by Anthony123; 01-16-2013 at 10:08 AM.

  2. #2
    Forum Contributor
    Join Date
    09-22-2012
    Location
    Berkeley, CA
    MS-Off Ver
    Excel 2010
    Posts
    112

    Re: Macro to Parse String

    This is not a macro, but it can be used to get the names pretty quickly.

    Use the text to columns feature to split col a into separate columns and then sort the data to remove spaces and other names like "room".

    Do you need a macro to automate the process or is this a one time thing?
    Attached Files Attached Files
    Last edited by Cofad; 01-15-2013 at 04:03 PM.
    ------------------------
    W2

  3. #3
    Registered User
    Join Date
    01-15-2013
    Location
    DC
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Macro to Parse String

    Thank you. I tried using the text to column freature but didnt know how to only parse the data with "Assigned:" as the first word. I needed a macro because i will be doing this action several times with several different spreadsheets.

  4. #4
    Forum Contributor
    Join Date
    09-22-2012
    Location
    Berkeley, CA
    MS-Off Ver
    Excel 2010
    Posts
    112

    Re: Macro to Parse String

    It won't only do the "Assigned" values, but after you sort it you can just delete all the others because they'll be grouped together.

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to Parse String

    Hi Anthony

    Welcome to the Forum!

    This code is in the attached...see if it does as you require. Let me know of issues.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  6. #6
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Macro to Parse String

    Hi John

    One of the values given by OP was
    Assigned: Susie Q Young -Rm 394
    so I would suggest you changed the line
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Alf

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to Parse String

    @Alf

    Again...a different reading of the requirement. If the OP also wants the Room assignment, as you suggested, easy fix. Thanks.

  8. #8
    Registered User
    Join Date
    01-15-2013
    Location
    DC
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Macro to Parse String

    Thanks for all your help! I really appreciate it!

  9. #9
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to Parse String

    Hi Anthony

    You're welcome...glad I could help. Thanks for the Rep.

+ 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