Google-sheets – Ways to iterate and append a date calculation a set number of times in Google Sheets

google sheetsgoogle-apps-scriptgoogle-sheets-arrayformulagoogle-sheets-query

Let's say I have a sheet with this dataset:

Start Date      Number of Days   
3/1/2019        2

From this input set, I want to make the following transformation:

Date
3/1/2019
3/2/2019
3/3/2019

A new date, incremented by one day, is added to the column "Date" for the total amount (listed under Number of Days).

Here's another dataset:

Start Date      Number of Weeks
3/1/2019        2

In this case, the resulting array should be:

Date
3/1/2019
3/8/2019
3/15/2019

Best Answer

Start Date      Number of Days   
3/1/2019        2

Assuming 3/1/2019 is cell A2 use the following formula =arrayformula(sequence(B2+1,1,0)+A2) and the result will be:

3/1/2019
3/2/2019
3/3/2019

If you want to do weeks a simple modification like this will give you the exact result you asked for:

=arrayformula(sequence(B2+1,1,0,7)+A2)

SEQUENCE