Google-sheets – ny way to dynamically modify dates based on number of days something would take

formulasgoogle sheetsgoogle-sheets-arrayformulagoogle-sheets-datesgoogle-sheets-query

Imagine you're creating a Google Sheet to track all of your tasks, how long they take, and their deadlines:

Task                    |Number of days| Start Date | Date Done
Buy plane tickets       |       5      | 15.12.2019 | 20.12.2019
Reserve hotel           |       2      | 21.12.2019 | 23.12.2019
Prepare snacks for trip |       1      | 24.12.2019 | 25.12.2019
Go on trip              |      14      | 26.12.2019 | 10.01.2020

Is there any way in Google Sheets to update the dates dynamically if another task is added in the middle?

Say you wanted to add renting a car to the plan, and it will take you five days. Is there any way in google sheets that once you add it, the sheet would automatically update from this:

Task                    |Number of days| Start Date | Date Done
Buy plane tickets       |       5      | 15.12.2019 | 20.12.2019
Reserve hotel           |       2      | 21.12.2019 | 23.12.2019
Rent a car              |       5      | 24.12.2019 | 29.12.2019
Prepare snacks for trip |       1      | 24.12.2019 | 25.12.2019
Go on trip              |      14      | 26.12.2019 | 10.01.2020

To this?

Task                    |Number of days| Start Date | Date Done
Buy plane tickets       |       5      | 15.12.2019 | 20.12.2019
Reserve hotel           |       2      | 21.12.2019 | 23.12.2019
Rent a car              |       5      | 24.12.2019 | 29.12.2019
Prepare snacks for trip |       1      | **30.12.2019** | **31.12.2019**
Go on trip              |      14      | **01.01.2020** | **14.01.2020**

Essentially automatically delay all the other tasks based on the newly introduced task?

Link to Google Sheet with an example of desired behaviour

If there is no way in Google Sheets, is there any other tool you know to do this?

Best Answer

paste in C4 cell:

=ARRAYFORMULA(QUERY(IF(B4:B=""; ;SUMIF(ROW(B3:B); "<="&ROW(B3:B); B3:B)+
 DATEVALUE(C3)); "where Col1 is not NULL"; 0)+ROW(INDIRECT("A1:A"&COUNTA(A4:A))))

0


paste in D3 cell:

=ARRAYFORMULA(IF(LEN(A3:A); TO_DATE(C3:C+B3:B); ))

0

spreadsheet demo