+ Reply to Thread
Results 1 to 5 of 5

Repeat a list of names X number of times

Hybrid View

  1. #1
    Registered User
    Join Date
    01-06-2014
    Location
    Ames, Iowa
    MS-Off Ver
    Excel 2010
    Posts
    14

    Repeat a list of names X number of times

    I'd like to be able to repeat a list of names X number of times. I've looked around but haven't found anything that fit.

    Example: Repeat count = 3

    Name1
    Name2
    Name3
    Name4

    becomes

    Name1
    Name2
    Name3
    Name4
    Name1
    Name2
    Name3
    Name4
    Name1
    Name2
    Name3
    Name4

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Repeat a list of names X number of times

    Here's a simple macro for that. I am not sure how to solve using formula.

    Sub CopyAndPaste()
    Dim intRepeat As Integer
    Dim ws As Worksheet
    Dim i As Long
    
    Set ws = ThisWorkbook.ActiveSheet
    With ws
    
    intRepeat = .Cells(1, 5).Value
    
        .Range("D2:D5000").ClearContents
        
        For i = 1 To intRepeat
            .Range("A2:A" & .Cells(Rows.Count, 1).End(xlUp).Row).Copy .Range("D" & .Cells(Rows.Count, 4).End(xlUp).Row + 1)
        Next i
    
    End With
    
    End Sub
    Attached Files Attached Files

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,412

    Re: Repeat a list of names X number of times

    An easy way to do this, assuming your names are in A1:A4, is to put this formula in A5:

    =A1

    Then copy this down to A12.

    If you want it more automatic, then with the repeat count in B1 you can put this formula in C1:

    =IF(ROWS($1:1)>COUNTA(A:A)*$B$1,"",INDEX(A:A,MOD(ROWS($1:1)-1,COUNTA(A:A))+1))

    then copy this down as far as you need to (it doesn't matter if you copy it too far - you will just get blanks).

    Hope this helps.

    Pete

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,648

    Re: Repeat a list of names X number of times

    Assuming repeated list starts from B1
    B1=CHOOSE(IF(MOD(ROW()-ROW($B$1)+1,4)=0,4,MOD(ROW()-ROW($B$1)+1,4)),"Name1","Name2","Name3","Name4")
    Drag down.
    Quang PT

  5. #5
    Registered User
    Join Date
    01-06-2014
    Location
    Ames, Iowa
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Repeat a list of names X number of times

    Thanks everyone. I needed a formula solution so Pete I modified your's a little and it worked well.

+ 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] Number of times a letter occurs in list of names
    By m1llz in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-29-2013, 07:39 AM
  2. How to repeat vba code a number of times depending on items in an excel list
    By qaliq in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-18-2013, 08:13 AM
  3. [SOLVED] How to repeat the same number for 'N" number of times in excel sheet
    By tulasiram in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-12-2013, 03:06 AM
  4. [SOLVED] VBA: repeat a formula a number of times
    By dinahajjar in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-24-2013, 11:03 AM
  5. Repeat list of names by number of ballots purchased
    By Laliberte78 in forum Excel General
    Replies: 4
    Last Post: 12-20-2011, 10:01 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