+ Reply to Thread
Results 1 to 10 of 10

Count Comma Delimited values in Cell, Convert to rows, Repeat Remaining info next to Rows

  1. #1
    Registered User
    Join Date
    01-28-2016
    Location
    Pune, India
    MS-Off Ver
    Office 2010
    Posts
    7

    Question Count Comma Delimited values in Cell, Convert to rows, Repeat Remaining info next to Rows

    Hi,
    I'm having a problem in VBA..
    What I want to do:
    - I have workbooks with table which has (let's say) 5 columns. Formatting is same throughout the 1000 workbooks.
    - 3rd column gives the ID No. to which the remaining values (from column 1,2,4,5) are linked
    - Sometimes multiple IDs are given to which the remaining data is same and needs to be repeated in master workbook.

    * Now i have figured out how to copy data row after row from all of the workbooks if the ID given in cell is single. But whenever multiple IDs appear in 3rd Column cell (Comma separated IDs ), then I don't know how to copy them in master workbook in each row and likewise copy the contents of Column 1,2,4,5 for all of the IDs.

    * Now i have logic as below, but being a fresher engineer my VBA skills are not up to par for this task.
    *** Logic : separate the comma separated values in cell somehow
    count and copy the values to rows
    copy remaining data the no. of times found in count or until found next empty row

    For next or do while inside if else maybe required.

    Can anyone show me the program to do so??? I'll be grateful and thanks in advance to all who'll help. thank you.
    Last edited by avpowar; 01-28-2016 at 06:10 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Count Comma Delimited values in Cell, Convert to rows, Repeat Remaining info next to R

    Hi and welcome to the forum.

    Please upload a workbook or a representative cut down copy, anonymised if necessary. It is always easier to advise if we can see your request in its context.

    Show a before and after situation with manually calculated results, explaining which information is data and which is results, and if it's not blindingly obvious how you have arrived at your results, some explanatory notes as well.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    01-28-2016
    Location
    Pune, India
    MS-Off Ver
    Office 2010
    Posts
    7

    Re: Count Comma Delimited values in Cell, Convert to rows, Repeat Remaining info next to R

    Sample.zip

    Hi Sir,
    Thank you for replying so soon.
    I've created sample sheets which you may call mini copies of the originals. (Sorry , can't upload original, will risk my job as a fresher uploading company data to public site)

    Attached Zip contains 3 village files and the master workbook to which the data is to be copied.
    I've done the copying for Village 1 and Village 3. But Can't update for village 2.(I can but it copies all values in one row opposed to what i want)

    Master workbook is the result I want From Village 1,2,3.

    Since i manually created this one. I'll Reply you the code i'm trying in 5 minutes sir.
    Please wait.

  4. #4
    Registered User
    Join Date
    01-28-2016
    Location
    Pune, India
    MS-Off Ver
    Office 2010
    Posts
    7

    Post Re: Count Comma Delimited values in Cell, Convert to rows, Repeat Remaining info next to R

    Master with results from my code.xlsm

    These are my results and you'll see the problem i'm Facing..
    The data files are in different folders than master workbook though.
    In sample.Zip I sent in one folder for convenience.
    Thank you Sir in advance.

  5. #5
    Registered User
    Join Date
    01-28-2016
    Location
    Pune, India
    MS-Off Ver
    Office 2010
    Posts
    7

    Re: Count Comma Delimited values in Cell, Convert to rows, Repeat Remaining info next to R

    anyone going to help??

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Count Comma Delimited values in Cell, Convert to rows, Repeat Remaining info next to R

    Hi,

    This is very confusing. Your macro refers to a sheet in the Master Workbook called "Model History" which doesn't exist. Please clarify.

  7. #7
    Registered User
    Join Date
    01-28-2016
    Location
    Pune, India
    MS-Off Ver
    Office 2010
    Posts
    7

    Re: Count Comma Delimited values in Cell, Convert to rows, Repeat Remaining info next to R

    That's Sheet 2.. Sorry For that Sir.

  8. #8
    Registered User
    Join Date
    01-28-2016
    Location
    Pune, India
    MS-Off Ver
    Office 2010
    Posts
    7

    Re: Count Comma Delimited values in Cell, Convert to rows, Repeat Remaining info next to R

    Sample Files.zip

    Attached File Contains 3 Village Files in a folder and 2 master files (one is expected and another is the result I get) . in master workbook's code, i give path to the folder where the village files are kept. then the code copies data from model history sheet of each village workbook and pastes it in sheet2 of master workbook.

  9. #9
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Count Comma Delimited values in Cell, Convert to rows, Repeat Remaining info next to R

    Hi,

    Try this instead
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    01-28-2016
    Location
    Pune, India
    MS-Off Ver
    Office 2010
    Posts
    7

    Re: Count Comma Delimited values in Cell, Convert to rows, Repeat Remaining info next to R

    Hi Sir,
    This worked flawless .. But when I modify it for my needs it copies the data without separating the comma separated values.
    I figured out the problem was that the cells having values that needed to be separated were referenced from another sheet. So I tried it on one sample where I basically copied the cells and pasted them as values in same place manually. then it worked. but it is nearly impossible to do this for large amount of sheets. So how to make it work for referenced cells?

    Currently my comma separated cells are in position B10 and B11
    and needs to be copied at H and I. So I changed it accordingly.
    and the sheets from which i am copying are macro enabled (if that matters.)

    Following is my new code for large data.

    Please Login or Register  to view this content.

+ 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] Multiple cells comma delimited to rows
    By CTRED in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-25-2014, 01:03 PM
  2. [SOLVED] Comma delimited data in multiple cells to rows
    By CTRED in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-19-2014, 03:10 PM
  3. [SOLVED] comma and dash delimited data to rows
    By sa02000 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-02-2013, 11:01 AM
  4. Separate comma-delimited values to rows
    By sporto in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-22-2013, 10:06 AM
  5. Separate comma delimited values to rows
    By grepolis in forum Excel General
    Replies: 3
    Last Post: 01-25-2011, 01:24 PM
  6. SUM of values in a comma delimited cell
    By Danexcel in forum Excel General
    Replies: 18
    Last Post: 01-15-2010, 10:59 AM
  7. Comma Delimited to Rows, Over 255 Records
    By CriticalBill in forum Excel General
    Replies: 1
    Last Post: 01-18-2008, 09:51 PM

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