+ Reply to Thread
Results 1 to 13 of 13

Need a formula to repeat values in column A a certain number of times

  1. #1
    Registered User
    Join Date
    11-12-2015
    Location
    Texas
    MS-Off Ver
    Excel 2013
    Posts
    15

    Need a formula to repeat values in column A a certain number of times

    Hey all,

    I want to populate a column (for example, column A on the attached sheet), where the values in column A will be repeated as many times as the value in column B

    Thus, the first 24 rows will say Ferrari, the next 12 rows will say Lamborghini, etc...

    I need a formula that recognizes that when it gets to row 24, that it should no longer need to copy Ferrari, but then switch to Lamborghini.

    I've been stabbing at this but don't know how to do this, any help would be greatly appreciated.

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Need a formula to repeat values in column A a certain number of times

    Please see attached file with array formula in column C.
    Attached Files Attached Files
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  3. #3
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Need a formula to repeat values in column A a certain number of times

    Not sure about doing it in a formula but its straight forward in a Sub.

    Please Login or Register  to view this content.
    EDIT: Should have known an Array Formula was the way forward
    If someone has helped you then please add to their Reputation

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

    Re: Need a formula to repeat values in column A a certain number of times

    Type "Ferrary" in A1
    In A2 then drag down:
    Please Login or Register  to view this content.
    Quang PT

  5. #5
    Registered User
    Join Date
    11-12-2015
    Location
    Texas
    MS-Off Ver
    Excel 2013
    Posts
    15

    Re: Need a formula to repeat values in column A a certain number of times

    AlKey, that worked great! However, I'm having an issue. I tried to copy that formula and apply it to my workbook but it doesn't return any results.

    I've attached my workbook I'm using.

    I want to repeat the "Date" column (column B) on the "Master Data" tab, by the number of times in column Z on that same tab.

    I want to return this information on the "Template" tab in column F under "Date"

    Any help would be greatly appreciated.

    Thanks
    Attached Files Attached Files

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

    Re: Need a formula to repeat values in column A a certain number of times

    Hic,
    Quite different between sample and actual! I have tried to sort "super car's name" for LOOKUP!
    Go to bed now.

  7. #7
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Need a formula to repeat values in column A a certain number of times

    Try it now

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    11-12-2015
    Location
    Texas
    MS-Off Ver
    Excel 2013
    Posts
    15

    Re: Need a formula to repeat values in column A a certain number of times

    Tried it again using that formula, still won't work.

    Not sure what's going on, i've attached the spreadsheet with the formula populated, it's just showing blank
    Attached Files Attached Files

  9. #9
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Need a formula to repeat values in column A a certain number of times

    This is an array formula! Array formula must be entered by using key combination of CTRL+SHIFT+ENTER and not just ENTER

  10. #10
    Registered User
    Join Date
    11-12-2015
    Location
    Texas
    MS-Off Ver
    Excel 2013
    Posts
    15

    Re: Need a formula to repeat values in column A a certain number of times

    Also, i need the range to go out from B2:b2000 and Z2:Z2000 (i'm just testing with two pieces of data at the moment, spreadsheet will have a lot of data going forward, which will be changing on a monthly basis

  11. #11
    Registered User
    Join Date
    11-12-2015
    Location
    Texas
    MS-Off Ver
    Excel 2013
    Posts
    15

    Re: Need a formula to repeat values in column A a certain number of times

    Whoops, my mistake! it works when i enter it as an array formula.

    However, if i change the range to go out 2000 cells for the two columns, it doesn't seem to work

  12. #12
    Registered User
    Join Date
    11-12-2015
    Location
    Texas
    MS-Off Ver
    Excel 2013
    Posts
    15

    Re: Need a formula to repeat values in column A a certain number of times

    Hey PJ,

    I tried using that VBA, but when I run it, it calculates the first value short 1, so instead of populating Ferrari 24 times as it should, it only does 23, the rest look good though.

    I'm unfamiliar with VBA, this is my first time trying it. What would I need to change in your code to correct this, and also to capture stuff in multiple columns.

    So, say I want to populate a column (using the example above), Column C to show Ferrari 24 times, etc... But also add a column to show something else 24 times in a different column.

    i've attached an example of what i mean
    Attached Files Attached Files

  13. #13
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Need a formula to repeat values in column A a certain number of times

    you would just add a 2nd repeattext variable and output that where you want
    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. Repeat cell values a certain number of times
    By strother1990 in forum Excel General
    Replies: 2
    Last Post: 09-24-2014, 12:43 PM
  2. [SOLVED] To repeat row values, a specified number of times
    By ramananhrm in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-09-2014, 11:30 AM
  3. Replies: 8
    Last Post: 09-20-2013, 08:12 AM
  4. 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
  5. Replies: 1
    Last Post: 04-04-2013, 05:29 PM
  6. Replies: 1
    Last Post: 04-04-2013, 10:53 AM
  7. 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

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