+ Reply to Thread
Results 1 to 5 of 5

Repeat Each Value From Column A X Times Based on Another Count

  1. #1
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    113

    Repeat Each Value From Column A X Times Based on Another Count

    I would really appreciate some help in trying to figure this out.

    I have a spreadsheet that presently contains 2 columns of data.
    Column A contains one list of unique numbers (that can range from 1 to 10,000)
    Column B contains a group value for those numbers (smaller range of 1 to 100)

    I am looking for a way to repeat each value in Column A based on the number of times their corresponding Col B values appear.
    The results could appear in Col C.

    A | B
    1 | 10
    2 | 10
    3 | 10
    4 | 20
    5 | 20
    6 | 30
    7 | 30
    8 | 30
    9 | 30

    For example, in the table above:
    The value 1 should appear 3 times in Col C (since its associated with the value 10, which appears 3 times)
    The value 2 should appear 3 times in Col C (since its associated with the value 10, which appears 3 times)
    The value 3 should appear 3 times in Col C as well (since its associated with the value 10, which appears 3 times)

    Likewise, the value 4 should appear 2 times in Col C (since its associated with the value 20, which appears 2 times)
    Similarly, the value 8 should appear 4 times in Col C (since its associated with the value 30, which appears 4 times)

    Of course I've left out some of the other numbers in Col A, but I hope this makes sense.

    As you can imagine, these value would get dumped into Col C and the list would be much longer than what appears in either cols A or B as the values in Col A should repeat based on count of times their associated Col B values appear.




    I've also attached a spreadsheet which illustrates the above if it helps!

    Thanks in advance all!
    Attached Files Attached Files
    Last edited by hamidxa; 07-30-2015 at 10:43 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: Repeat Each Value From Column A X Times Based on Another Count

    See attachment:
    Attached Files Attached Files

  3. #3
    Valued Forum Contributor
    Join Date
    09-17-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    454

    Re: Repeat Each Value From Column A X Times Based on Another Count

    Below is a vba solution that I posted yesterday to a very similar request to yours.
    http://www.excelforum.com/excel-gene...e-records.html

    Change input and output range parameters as required. You don't need to know how long the result list will be.

    ExpandData.xlsm

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    113

    Re: Repeat Each Value From Column A X Times Based on Another Count

    Thank you all for your help!

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Repeat Each Value From Column A X Times Based on Another Count

    Quote Originally Posted by WHER View Post
    See attachment:
    It would help ALL OF US if you were to put your proposed solution into the reply itself and not "hidden" in a file that some may not be able to download.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ 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. Replies: 8
    Last Post: 09-20-2013, 08:12 AM
  2. [SOLVED] Repeat text 3 times down column
    By Kellypeterson in forum Excel General
    Replies: 13
    Last Post: 09-05-2013, 04:33 AM
  3. Repeat a formula a finite number of times in a column
    By alsers in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-05-2013, 11:18 AM
  4. Replies: 1
    Last Post: 04-04-2013, 10:53 AM
  5. Replies: 1
    Last Post: 10-04-2012, 01:53 PM
  6. [SOLVED] Count repeat numbers in column B based on a condition from Column Al
    By helpbitte in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-24-2012, 10:11 AM
  7. How to repeat a macro x number of times based on a value in a cell
    By gypsyhotelier in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-19-2011, 05:11 PM
  8. Repeat a cell value in another column X number of times
    By art1234 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-31-2011, 02:36 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