Search code examples
google-sheetsgoogle-sheets-formulasequencerepeat

How to create a sequence of numbers with repeat and increment at intervals in google sheets


I need a single cell formula to create a sequence of numbers with a limit in Google Sheets as shown in the image.

3 rows repeat the value

then Increment by 5

enter image description here


Solution

  • Use this formula, you can adjust the Sequence() and REPT(rg&",",3) parameters to your need.

    In this example Sequence(number_of_unique_numbers,columns,start_at,increment_by)

    And REPT(rg&",",Repeat_N_times)

    =ArrayFormula(FLATTEN(SPLIT(BYROW(SEQUENCE(3,1,5,5), 
     LAMBDA(rg, IF(rg="",,REPT(rg&",",3)))),",")))
    

    enter image description here

    Option 02
    Based on Themaster - answer we use lambda with the names.
    u unique
    s start
    r repat n time

    =LAMBDA(u,s,r, FLATTEN(MAKEARRAY(u,r,LAMBDA(u,r,u*s))))
           (4,5,3)
    

    enter image description here

    Used formulas help
    ARRAYFORMULA - FLATTEN - SPLIT - BYROW - SEQUENCE - LAMBDA - IF - REPT - MAKEARRAY