Search code examples
arraysdateif-statementgoogle-sheetsarray-formulas

IF statements to add data between two dates?


I want to have a different value in the cell depending on the date entered i.e. if the date is between 04/01/2021 and 04/25/20201 then 20%. (If 05/01/2021-05/10/2021 then 15%.)

I am tracking growth times of seedlings between late fall to early spring. I would like to enter the seeding date and days to maturity and have "15%" or whatever pop up so I can calculate adjusted days to maturity without looking it up every date every single time.

Google sheets/Excel.


Solution

  • try:

    =ARRAYFORMULA(IF(A2:A="",,
     IF((A2:A >= DATEVALUE("01/04/2021"))*(A2:A <= DATEVALUE("25/04/2021")), 20%,
     IF((A2:A >= DATEVALUE("01/05/2021"))*(A2:A <= DATEVALUE("10/05/2021")), 15%, ))))
    

    enter image description here

    see also: https://webapps.stackexchange.com/q/123729/186471