Search code examples
arraysgoogle-sheetsgoogle-sheets-formulaarray-formulasdynamic-arrays

How to create array of given length and same number?


When using SUMSERIES I need to specify "the array or range containing the coefficients of the power series" but I want to make it so the number of elements is dynamic while the element itself (1) remains the same. Example:

SUM FROM 0 TO N of x^1,5

(cell) Length of series N : 7  -- > SUMSERIES(1,5;0;1;{1,1,1,1,1,1,1})

But I should be able to change the seven for a 3 and get --> SUMSERIES(1,5;0;1;{1,1,1})

In Java for example you'd declare and instantiate the array --> int[] arr = new int[N];

And then fill in a loop --> for(int i = 0; i <arr.length; i++) {arr[i] = 1,5}

Thanks in advance and sorry if the explanation isn´t clear, it's my first time around hehe


Solution

  • this should work:

    =SUMSERIES(1,5;0;1;SEQUENCE(1,[cell],1,0))