Search code examples
google-sheetsgoogle-sheets-formula

How to Auto Fill Date Column (with +30days) form Another Date Column in Google Sheet


I have 2 Columns like this

enter image description here

Where :

  1. Start date is inputed by user
  2. Finish Date is automatically filled with (Start Date + 30 days)

I have used this formula in Finish Date Column

=date(year(A:A),month(A:A),day(A:A)+30)

It works well, But the formula will work if we drag the blue box any number of cells down. I want to make it automatically filled after we input the start date. I also have read that we should use some script but I don't uderstand. Any solution? Thanks!


Solution

  • If you have start dates in A2:A, then array way to obtain the corresponding end date (30 days after) on each row is as follow in B2 cell.

    ARRAYFORMULA(if(A2:A="","", A2:A+30))
    

    Note: You can also put the condition like this: if(A2:A="",, A2:A+30) or just:

    ARRAYFORMULA(if(LEN(A2:A),A2:A+30,))