+ Reply to Thread
Results 1 to 9 of 9

Need help on repeating values in columns based on the table people count

  1. #1
    Forum Contributor
    Join Date
    06-26-2013
    Location
    LAX
    MS-Off Ver
    Excel 2007,Excel 2010
    Posts
    363

    Need help on repeating values in columns based on the table people count

    Hello Experts,

    I need help in VBA, on how to repeat values in columns based on table.

    We have a table with Job IDs in a column A, and for next 16+ weeks, week wise we need to fill in how many people we think that each job requires.

    week1 week 2
    Job1 3 1
    Job2 2 2
    Job2a 1 3

    Once we decide the numbers, we have a different sheet, where we need to fill in for every week, with the job name x people like,

    week 1 week 2'

    Job1 Job1
    Job1 Job2
    Job1 Job2
    Job2 Job2a
    Job2 Job2a
    Job2a Job2a

    Now we were doing this manually for long time and with the help of internet and some basic VBA , i was able to found to a script and changed to suit my need which repeats the values based on range.

    Please Login or Register  to view this content.

    The issue here is the input range is column A and the count range should be in column B and the output will be in one column.
    What I would need is input will be in column A ( job id) and the count range will be from Column B - column BA (week wise table). The output should be also from Column B - Column BA. Basically till whatever column the table has numbers.

    Can somebody help me on this.

    Thanks a lot.
    Last edited by elayaz; 06-28-2016 at 08:31 AM. Reason: complying with Rule 3

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,592

    Re: Need help on repeating values in columns based on the table people count

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



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

  3. #3
    Forum Contributor
    Join Date
    06-26-2013
    Location
    LAX
    MS-Off Ver
    Excel 2007,Excel 2010
    Posts
    363

    Re: Need help on repeating values in columns based on the table people count

    Edited as per Rules

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,592

    Re: Need help on repeating values in columns based on the table people count

    Will this work for you.

    If you edit value (columns 2 or 3 now but criteria can change if more columns you'll use) in sheet2 (same column) you will get result.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    06-26-2013
    Location
    LAX
    MS-Off Ver
    Excel 2007,Excel 2010
    Posts
    363

    Re: Need help on repeating values in columns based on the table people count

    Hi Zbor,

    This is brilliant. But how to extend the same for multiple weeks/column in sheet2. What criteria should I change.

    I have data for next 75 weeks, which I need to update.

    Can you help?

    Thanks

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,592

    Re: Need help on repeating values in columns based on the table people count

    Jus change IF part where it check for columns.
    Instead of checking
    Please Login or Register  to view this content.
    You can check

    Please Login or Register  to view this content.
    Adjust for columns that you use.

  7. #7
    Forum Contributor
    Join Date
    06-26-2013
    Location
    LAX
    MS-Off Ver
    Excel 2007,Excel 2010
    Posts
    363

    Re: Need help on repeating values in columns based on the table people count

    Changed the IF part and it's worked perfect for me. Thanks a ton @zbor

  8. #8
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,592

    Re: Need help on repeating values in columns based on the table people count

    Glad I could help.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Thanks.

  9. #9
    Forum Contributor
    Join Date
    06-26-2013
    Location
    LAX
    MS-Off Ver
    Excel 2007,Excel 2010
    Posts
    363

    Re: Need help on repeating values in columns based on the table people count

    Hello,

    Marking this thread as unsolved since I have a question.

    Right now, the script is working good. Thanks again. But It works only when I copy each and every column numbers and paste here in to this sheet to generate the data. If I copy multiple columns numbers at one go, paste here, still it's populating only one column.

    For example,

    week1 week 2
    Job1 3 1
    Job2 2 2
    Job2a 1 3

    I need to copy week 1 column numbers ( 3,2,1) separately and copy paste into this sheet to generate week 1 jobs, and week 2 so on. I would like to copy week1,week2, till week75 numbers at one go and generate like below at one go.

    week 1 week 2'
    Job1 Job1
    Job1 Job2
    Job1 Job2
    Job2 Job2a
    Job2 Job2a

    Is there any way to copy multiple column numbers to generate multiple columns.

    Thanks

+ 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] Looking for a formula that will count how many people at each table.
    By Losguapos1 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-23-2016, 09:22 AM
  2. Finding a macro that will populate a table from another table based on a columns values
    By Daril_Ghiroza in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-27-2015, 02:26 PM
  3. Replies: 3
    Last Post: 05-08-2015, 12:05 PM
  4. [SOLVED] Find count of Unique or Duplicate Values based on Concatenated values in 2 columns
    By bdicarlo1 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-03-2014, 12:42 AM
  5. Count Unique values in Column based on values in other columns
    By dmschave in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-17-2014, 11:06 AM
  6. count unique values in columns based on date values
    By cclntn in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-29-2010, 06:16 PM
  7. Replies: 0
    Last Post: 01-29-2010, 06:40 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