Google-sheets – Google Sheets populate X cells with formulas based on single cell containing value X

formulasgoogle sheetsgoogle-sheets-arrayformula

Google sheets dynamically populate cells based on single cell value. I don't know what the term would be called and a bunch of searching hasn't resulted in any lead on what it would be called.

What I would like to do is populate X number of rows with the formulas based upon a cell that has the number value of X.

An example would be an amortization sheet for a loan. If you have a cell that contains the term years 15 that's 180 periods (15*12). The formula is the same for each column and dragging them down 180 rows would give me the same results it would auto-populate the cells. If I then changed the term cell value to 30 years loan I would have to drag it another 180 rows for a total of 360.

Instead, I'm trying to figure out how to have the sheet auto-fill the values based on the term cell number. It would then auto-populate the rows based on that value.

What is this term called or how could I go about doing this? Do I need to create my own macro in the sheets script?

Best Answer

You are supposed to use a cell reference of the cell you have a value in so instead =15*12
you do =A$1*12 and drag down:

0

if you don't want to play with dragging you need to use array formula:

=ARRAYFORMULA(IF(ROW(A1:A10), A$1*12, ))

0