+ Reply to Thread
Results 1 to 12 of 12

Fill rows with incremental data

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-22-2016
    Location
    london
    MS-Off Ver
    2013
    Posts
    121

    Fill rows with incremental data

    hi im wondering if there is an easier was of filling our rows of incremental data, but it needs to be for example ten cells of the same data, so for example

    column b, rows 1-10, filled with 1
    column b, rows 11-20 filled with 2
    column b, rows 21-30 filled with 3

    and so on

    is there a function or formula i can use to apply this?

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Fill rows with incremental data

    Try:
    Formula: copy to clipboard
    =INT((ROW()-1)/10)+1
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  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: Fill rows with incremental data

    Is the 1, 2, 3 the REAL data or is that just made up for the example?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Forum Contributor
    Join Date
    08-22-2016
    Location
    london
    MS-Off Ver
    2013
    Posts
    121

    Re: Fill rows with incremental data

    the 1,2,3 is just made up data, but the real data will be an integer

  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: Fill rows with incremental data

    Quote Originally Posted by kobiashi View Post
    the 1,2,3 is just made up data, but the real data will be an integer
    Tell us what the real data is.

  6. #6
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Fill rows with incremental data

    Quote Originally Posted by kobiashi View Post
    the 1,2,3 is just made up data, but the real data will be an integer
    Is the real data related to the row number - in which case, what is the algorithm?

    Or is it unrelated - in which case, where / how do you store your list of values?

    And how many rows / values will you be dealing with?

  7. #7
    Forum Contributor
    Join Date
    08-22-2016
    Location
    london
    MS-Off Ver
    2013
    Posts
    121

    Re: Fill rows with incremental data

    hi, the real data is numbers 354 to 510, each number has to be added 166 times,

  8. #8
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Fill rows with incremental data

    Quote Originally Posted by kobiashi View Post
    hi, the real data is numbers 354 to 510, each number has to be added 166 times,
    In that case, you could use:
    Formula: copy to clipboard
    =INT((ROW()-1)/166)+354
    in B1:B26062.


    This macro speeds up the entry:
    Sub foo()
        Dim lLow As Long
        Dim lHigh As Long
        Dim lQty As Long
        
        'Change variables to suit
        lLow = 354
        lHigh = 510
        lQty = 166
        
        With ActiveSheet.Range("B1").Resize((1 + lHigh - lLow) * lQty, 1)
            .ClearContents
            .Formula = "=INT((ROW()-1)/" & lQty & ")+" & lLow
            .Value = .Value
        End With
        
    End Sub

  9. #9
    Forum Contributor
    Join Date
    08-22-2016
    Location
    london
    MS-Off Ver
    2013
    Posts
    121

    Re: Fill rows with incremental data

    hi thank you , i used the marco worked a treat

    could i bother you with one more question

    in another column i need to add numbers 354 to 510, incrementally, and carry this out 166 times, could this marco be customised to suit?

  10. #10
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Fill rows with incremental data

    Quote Originally Posted by kobiashi View Post
    in another column i need to add numbers 354 to 510, incrementally, and carry this out 166 times, could this marco be customised to suit?
    Sure. Use:
    Sub bar()
        Dim lLow As Long
        Dim lHigh As Long
        Dim lQty As Long
        
        'Change variables to suit
        lLow = 354
        lHigh = 510
        lQty = 166
        
        With ActiveSheet.Range("C1").Resize((1 + lHigh - lLow) * lQty, 1)
            .ClearContents
            .Formula = "=MOD((ROW()-1),(" & 1 + lHigh - lLow & "))+" & lLow
            .Value = .Value
        End With
        
    End Sub

  11. #11
    Forum Contributor
    Join Date
    08-22-2016
    Location
    london
    MS-Off Ver
    2013
    Posts
    121

    Re: Fill rows with incremental data

    worked a treat!

    thank you.

  12. #12
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Fill rows with incremental data

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. You can also 'Add Reputation' to those who have helped you. 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] Fill Handle Problems (fill data from 2 rows)
    By JoelPak in forum Excel General
    Replies: 5
    Last Post: 03-10-2016, 12:34 PM
  2. [SOLVED] Incremental Rows
    By mikepacman in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-28-2014, 09:42 AM
  3. Fill an incremental time entry in blocks of 4 rows
    By suedavies in forum Excel General
    Replies: 4
    Last Post: 04-08-2014, 04:01 PM
  4. Incremental numbering at variable intervals of rows
    By tek9step in forum Excel General
    Replies: 4
    Last Post: 03-18-2011, 09:58 AM
  5. Replies: 3
    Last Post: 08-18-2009, 09:46 PM
  6. Fill range with incremental numbers
    By Jaymond Flurrie in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-26-2008, 01:13 AM
  7. Extract unique rows and incremental copy
    By vedamv in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-29-2006, 03:48 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