+ Reply to Thread
Results 1 to 7 of 7

Hyterate copy and paste a x number of time

  1. #1
    Registered User
    Join Date
    09-20-2012
    Location
    Milan
    MS-Off Ver
    Excel 2010
    Posts
    18

    Hyterate copy and paste a x number of time

    Hi everyone,

    I have a list of labels (e.g. A,B,C,D,....) and I need to repeat each label a fixed amount of time (e.g. 5) by rows. In such a way I would get the result as in the attached example.

    Example.xls

    I think the fast solution is to use a simple macro but I do not know how to do it.

    Thanks in advance.

    Davide
    Last edited by davide88; 04-08-2013 at 04:27 PM.

  2. #2
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Hyterate copy and paste a x number of time

    Here is the macro:

    Please Login or Register  to view this content.
    Gary's Student

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

    Re: Hyterate copy and paste a x number of time

    Just for the heck of it here's a formula method.

    In B3:B6 enter the number of times you want each item to be repeated.

    Enter this array formula** in C3:

    =IF(ROWS(C$3:C3)>SUM(B$3:B$6),"",INDEX(A$3:A$6,MIN(IF(SUBTOTAL(9,OFFSET(B$3,,,ROW(INDIRECT("1:4"))))>=ROWS(C$3:C3),ROW(INDIRECT("1:4"))))))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    Copy down until you get blanks.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    09-20-2012
    Location
    Milan
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Hyterate copy and paste a x number of time

    Thanks both for your replies.

    About the macro, I am working on it.
    About the formulas, it seems not working....I get only A repeted every time I copy down!

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Hyterate copy and paste a x number of time

    You'll need to use CNTRL SHFT ENTER for Tony's formula (from your results, you did not?)

    Here's a simple, non-arrayed formula
    =INDEX($A$3:$A$6,INT((ROW(A1)-1)/5)+1)
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  6. #6
    Registered User
    Join Date
    09-20-2012
    Location
    Milan
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Hyterate copy and paste a x number of time

    I used CNTRL SHFT ENTER both highlighting all the 20 cells covered by the outcome and only in C3 as he said.
    Anyway, the last works perfectly and I think can also make the macro working.

    Thank you all!

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

    Re: Hyterate copy and paste a x number of time

    Quote Originally Posted by davide88 View Post
    About the formulas, it seems not working....I get only A repeted every time I copy down!
    Here's the sample file:

    Example(1).xlsx

    You can put any numbers you want in B3:B6 (but the formula is only copied down so far).

    EDIT: If every entry is to be repeated the same number of times here's another shorter less complex formula.

    No need to enter the repeat values in column B. This value will be entered into the formula.

    Entered in C3 and copied down:

    =INDEX(A$3:A$6,CEILING(ROWS(C$3:C3)/5,1))
    Last edited by Tony Valko; 04-08-2013 at 07:08 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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