+ Reply to Thread
Results 1 to 5 of 5

Copy data from one column and create a new one

Hybrid View

  1. #1
    Registered User
    Join Date
    08-04-2015
    Location
    Pittsburgh, PA
    MS-Off Ver
    2013
    Posts
    2

    Exclamation Copy data from one column and create a new one

    I've been working with a macro that I have inherited and I'm trying to make some updates to help with some changes that have been made in the department.

    I have data in column AE, which is titled 'crs_cde' (see below).

    crs_cde
    JOUR 103 D A
    JOUR 101 D A
    JOUR 101 O A ON
    JOUR 215 D B
    JOUR 317 D A
    JOUR 341 D A
    JOUR 541 D A
    JOUR 215 D A
    JOUR 280 D A
    JOUR 280 D B
    (note that this is just a sampling. I pull this data from an internal system at various times, so the length of the column fluctuates)

    I would like to split this data into two new cells, while retaining the original data in the original cells.

    Basically, I want to take the 'JOUR' data and put it in a new column titled 'Course Cde' (column BP) and the 'D A', 'O A ON', etc data into a new column titled 'Course Sec' (Column BQ).

    I'm new to macros, so I'm having a difficult time writing a code that will help me achieve this goal. Any help would be greatly appreciated.

    Thank you!
    Last edited by jnof86; 08-04-2015 at 11:16 AM.

  2. #2
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Copy data from one column and create a new one

    For 'Course Cde'
    =LEFT(A2,FIND(" ",A2)-1)
    For 'Couse Sec'
    =RIGHT(A2,LEN(A2)-FIND(" ",A2,1+FIND(" ",A2)))

    THAT IS ASSUMING the data you are splitting is in the A column - you would put that formula in row 2 and copy down. This also assumes you will ALWAYS have 'Course Cde'(space)'number'(space)'course sec' in your data column (it's breaking up the string based on where the spaces occur).
    Remember, saying thanks only takes a second or two. Click the star icon(*) below the post you liked, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,744

    Re: Copy data from one column and create a new one

    You don't need a macro to do this. If your data were in Column A, then in Column B =Left(A1,8) and copy down. In column C, =right(A1,len(A1)-8) and copy down.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Registered User
    Join Date
    08-04-2015
    Location
    Pittsburgh, PA
    MS-Off Ver
    2013
    Posts
    2

    Re: Copy data from one column and create a new one

    Thank you, alansidman and GeneralDisarray. This helps.

  5. #5
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Copy data from one column and create a new one

    Glad to help:


    Please mark your thread [SOLVED]

    (how to do that)
    To mark your thread solved do the following:
    New Method
    -Go to the top of the first post
    -Select Thread Tools
    -Select Mark thread as Solved

    Old Method
    - Go to the first post
    - Click edit
    - Click Advance
    - Just below the word "Title:" you will see a dropdown with the word No prefix.
    - Change to Solve
    - Click Save

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Create new sheets and copy/paste data based on values in a column or columns
    By quintans1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-04-2015, 12:15 PM
  2. Replies: 5
    Last Post: 11-17-2014, 02:40 PM
  3. Create macro to copy data using column headings
    By zkhan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-31-2013, 02:01 AM
  4. Replies: 2
    Last Post: 10-08-2013, 02:58 PM
  5. Copy column list to create new worksheets
    By stonegwene in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-08-2011, 11:30 AM
  6. how to create automatic copy and paste in one column ?
    By legolas in forum Excel General
    Replies: 2
    Last Post: 12-22-2008, 03:56 AM
  7. macro: copy data and create worbooks from a column
    By bijnok in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-10-2008, 10:52 AM

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