Home > OS >  Array formula to fill a sequence of n numbers in a column
Array formula to fill a sequence of n numbers in a column

Time:03-11

I have a Google sheet that has a sequence of numbers in the left column:

Sample Database

I'd like to write an array formula in A1 that automatically adds the next number in the sequence when a new row is added to the sheet.

For example, if I add a row 8, an 7 (the next number in the sequence) automatically fills in cell A8. I've tried this with the Sequence function, but that requires a pre-defined number of rows. I've also tried to do an array formula that uses something like "A3=A2 1", but I can't get the syntax to work in an array.

CodePudding user response:

Try the following in cell A1:

={"Sequence";sequence(rows(A2:A))}
  • Related