+ Reply to Thread
Results 1 to 7 of 7

Separate strings into columns

  1. #1
    Registered User
    Join Date
    03-01-2014
    Location
    Romania
    MS-Off Ver
    Excel 2007
    Posts
    3

    Separate strings into columns

    Hello everyone,

    I just started an excel project and i need some help with a macro. ( excel 2007, 2010 available as well )

    I have a database made of strings. Every string is on a different line. The strings are in this format:

    NAME domiciliat în CITY NAME, nr. 2, Jud. COUNTY NAME - 151 shares
    NAME domiciliat în CITY NAME, nr. 6, Jud. COUNTY NAME - 29802 shares
    NAME domiciliat în CITY NAME, nr. 9, Jud. COUNTY NAME - 3 shares

    ( domiciliat means "living in", Jud. means "county")

    What i basically need is a macro to separate the name, adress, county and shares, so i can get 4 clean columns.
    Sometimes the cities have a "-" or a "." in their name

    I would really appreciate any help/tips you could give me.

    Best regards,
    Nvy
    Last edited by Nvy; 03-01-2014 at 05:54 AM.

  2. #2
    Registered User
    Join Date
    01-01-2013
    Location
    melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    55

    Re: Really need some help ^^

    if they all have commas between them you can go
    Data, text to columns, delimited, checkbox 'comma', finish..

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Really need some help ^^

    Hi, Nvy,

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution.

    Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Registered User
    Join Date
    03-01-2014
    Location
    Romania
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Separate strings into columns

    Sorry, didn't know that ^^, edited now.

    They are not separated by commas, that's the problem.

    The format is the exact one i posted, NAME ( just space ) ADRESS ( comma) COUNTY ( "-" ) SHARES
    Last edited by Nvy; 03-01-2014 at 05:58 AM.

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Separate strings into columns

    Hi, Nvy,

    thanks.

    You could try and use the space for splitting up like this
    Please Login or Register  to view this content.
    Display in the Immediate window:
    Please Login or Register  to view this content.
    You could assign the numbers in the array to the columns you want.

    Ciao,
    Holger

  6. #6
    Registered User
    Join Date
    03-01-2014
    Location
    Romania
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Separate strings into columns

    Good morning,
    Thank you for your answer Holger.

    The only problem is that the NAME sometimes has 3 words/initials ( ex: L. John Doe ), but in other instances it only has 2 parts ( John Doe ). I'm a bit worried the columns could get scrambled.

    P.S. i'm a newb in macros ^^

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Separate strings into columns

    Can you give us a small sample workbook showing what you have and your desired result?

+ 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