+ Reply to Thread
Results 1 to 6 of 6

Separating column into multiple columns using row value

  1. #1
    Registered User
    Join Date
    04-06-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    2

    Separating column into multiple columns using row value

    Hi,

    I want to separate a column into multiple columns by giving a script a string to split the column by. I have over 5000 rows that I want to separate so I would like to do this via VBA (or some kind of code). The data is set out like this:

    enemyID
    0
    0.3749957859
    0.4986839990
    etc....
    enemyID
    1
    0.848598690
    0.278965799
    etc....

    I want to be able to separate the column at every instance of "enemyID" (or another string) that appears in the column. It would like it to look like this:

    enemyID enemyID
    0 1
    0.3749957859 0.848598690
    0.4986839990 0.278965799
    etc.... etc....


    I'm unfamiliar with VBA and this is beyond my Excel knowledge. If anyone knows if this question has been answered or how to solve this, I'd appreciate any help. Please let me know if I need to provide more detail.

    Thank you.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Separating column into multiple columns using row value

    Try this code
    Please Login or Register  to view this content.
    Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
    Choose Insert | Module
    Where the cursor is flashing, choose Edit | Paste

    To run the Excel VBA code:
    Choose View | Macros
    Select a macro in the list, and click the Run button
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    03-24-2013
    Location
    Earth
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    81

    Re: Separating column into multiple columns using row value

    Hi ,

    pls view the attachment , some vba code ,will finger this out .



    Good Luck !
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Separating column into multiple columns using row value

    Output in sheet 3

    Please Login or Register  to view this content.

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

    Re: Separating column into multiple columns using row value

    Try
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    04-06-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Separating column into multiple columns using row value

    Thank you for all your help everybody, your code has been extremely helpful and educational. I really appreciate the time you've given to me.

+ 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