I am trying to use ARRAYFORMULA()
in Google Sheets to automatically apply a formula whenever a new row is entered. What I want is to check if today falls between two dates (a start and end date) or not. My formula:
=arrayformula(if(isblank(A2:A), "", if(and(today() >= B2, today() <= D2), "On Leave", "Available")))
That formula keeps checking against B2 and D2 for all rows inserted, so I tried this:
=arrayformula(if(isblank(A2:A), "", if(and(today() >= B2:B, today() <= D2:D), "On Leave", "Available")))
This second formula checks against all the values in column B and column D for every row, as against checking the respective value in column B and column D for that particular row eg row 3: B3, D3; row 4: B4, D4 etc.
Is there anyway I can get my desired behaviour? I've attached a screenshot of my sheet.
With the correct formula, Bruce Lee would not be on leave.
在数组公式中,您需要使用*(乘)而不是AND来获得所需的行为:
=arrayformula(if(isblank(A2:A), "", if((today() >= B2:B)*( today() <= D2:D), "On Leave", "Available")))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.