+ Reply to Thread
Results 1 to 8 of 8

Cut parts of data in cell with var delimiters to separate cells and copying adjacent data

  1. #1
    Registered User
    Join Date
    09-18-2014
    Location
    Manila, Philippines
    MS-Off Ver
    Office 2016 for Windows
    Posts
    14

    Cut parts of data in cell with var delimiters to separate cells and copying adjacent data

    Hi Excel Experts,

    a somewhat inconsistent data download leaves me with a messy file that needs to be re-structured (see uploaded sample file, sheet download).

    The problem is that a cell may contain separate data entries (five alphanumerical characters), which are separated by different delimiters (that's why text import and conversion won't work). Delimiters may be, for example, a single or a number of consecutive spaces, line break, colon etc.

    I'd like to have this data in the cell split to separate rows and the order of the original columns swaped. To the left and right of the messy column, there is also cells with data, that should be added per row in the columns next to the one with the split values (desired output also shown in uploaded sample file, sheet restructured). Since I have several source file with like 2000 rows, doing it manually would take weeks and would be very prone to typos.

    Thanks for your help,
    Regards,
    Noah
    Attached Files Attached Files

  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: Cut parts of data in cell with var delimiters to separate cells and copying adjacent d

    SEE ATTACHED FILE:

    You will need to give the macro the proper Source and Target worksheet names (highlighted below)

    Please Login or Register  to view this content.
    Attached Files Attached Files
    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
    Registered User
    Join Date
    09-18-2014
    Location
    Manila, Philippines
    MS-Off Ver
    Office 2016 for Windows
    Posts
    14

    Re: Cut parts of data in cell with var delimiters to separate cells and copying adjacent d

    HI GeneralDisarray,

    sorry for the late response. Your code works great already. But I noticed there actually is also some strings that are five characters in length, so either five or six (alphanumerical both). Is there a way to somehow add it in?
    Regards,
    Noah

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

    Re: Cut parts of data in cell with var delimiters to separate cells and copying adjacent d

    Yes, but it become more difficult.

    Are the alpha-numeric string only 5 or 6 characters in length?

  5. #5
    Registered User
    Join Date
    09-18-2014
    Location
    Manila, Philippines
    MS-Off Ver
    Office 2016 for Windows
    Posts
    14

    Re: Cut parts of data in cell with var delimiters to separate cells and copying adjacent d

    Yes, only 5 or 6. Actually starting with a number and ending with a letter

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

    Re: Cut parts of data in cell with var delimiters to separate cells and copying adjacent d

    Sorry - meant to answer but got swamped with other things.


    Best way forward would be to just code in a way to find the 'dataLength' as part of the problem - previously I set this as a constant ah the top of the module. Now, instead of a constant we can use a DIM statement to make that value change as needed..

    The new For loop will find the proper length - it could be any length, not just the 5 or 6.


    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    09-18-2014
    Location
    Manila, Philippines
    MS-Off Ver
    Office 2016 for Windows
    Posts
    14

    Re: Cut parts of data in cell with var delimiters to separate cells and copying adjacent d

    Thank you so much GeneralDisarray. Works perfect and saves weeks of manual work!

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

    Re: Cut parts of data in cell with var delimiters to separate cells and copying adjacent d

    You are welcome, thank you for the feedback

+ 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. Copying data in Cells with macro which adds the data to other parts of workbook $30
    By switzd0d in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-24-2015, 08:24 AM
  2. [SOLVED] Copying cell data in one column when duplicate cells located in separate column
    By Excelcious in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-10-2015, 02:41 AM
  3. Copying data from adjacent cell to blank cell (left side)
    By raghunaik in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-14-2015, 08:20 AM
  4. Excel Genius Needed - Copying Data into Adjacent Cells
    By financeanalyst in forum Excel General
    Replies: 3
    Last Post: 04-03-2014, 04:42 PM
  5. [SOLVED] Copying today's date into cell when multiple data is entered into adjacent cell
    By SChapman in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 04-16-2013, 04:12 PM
  6. copying data to an adjacent cell
    By Paul K. in forum Excel General
    Replies: 2
    Last Post: 10-05-2005, 11:05 AM

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