mtagliaferri
Board Regular
- Joined
- Oct 27, 2004
- Messages
- 156
I am trying to determine leave entitlement based on the length of service by the 1st of April of the year and if current date (Today()) is greater than or equal to 1st of April.
The employee starts with 28 days of leave which then become 30 once completed 2 full years of service by the 1st of April.
For the below example I am replacing Today() with Current Date
Date of Joining 15/02/18 current date 19/02/21 entitlement 30 from 01/0420 (as by that date has 2+ years of service.
Date of Joining 15/02/19 current date 19/02/21 entitlement 28 (although is 2+ years of service it is not yet 1st of April) however once current date is 01/04/21 or over it will become 30 days.
I have attached a few screenshots of my very wingy way of getting to what I want and still is not working.
The approach I have taken is to determine when is the 2 year anniversary from date of joining using
I have then calculated the date difference in years between Date of Joining and Anniversary using
Then I would get the entitlement by using an IF AND statement which would determine IF Current Date (which would be Today() on the final project) is => than Anniversary date AND Years => 2 would return 30 otherwise 28 using
Unfortunately I am struggling with the formula, I have also split the IF AND formula to see if it worked in Case 1 and 2 but still have hit a brick wall.
I am sure there is a less wingy way of getting the solution in one single formula.
The employee starts with 28 days of leave which then become 30 once completed 2 full years of service by the 1st of April.
For the below example I am replacing Today() with Current Date
Date of Joining 15/02/18 current date 19/02/21 entitlement 30 from 01/0420 (as by that date has 2+ years of service.
Date of Joining 15/02/19 current date 19/02/21 entitlement 28 (although is 2+ years of service it is not yet 1st of April) however once current date is 01/04/21 or over it will become 30 days.
I have attached a few screenshots of my very wingy way of getting to what I want and still is not working.
The approach I have taken is to determine when is the 2 year anniversary from date of joining using
Excel Formula:
=DATE(YEAR(A2)+2+(MONTH(A2)>4),4,1)
Excel Formula:
=DATEDIF(A2,C2,"y")
Excel Formula:
=IF(AND("$H$2">="C2",D3>=2,),28,30)
I am sure there is a less wingy way of getting the solution in one single formula.