# Pro-rated leave for range

#### ambz123

##### Board Regular
Hi,

I am task to create a leave management that auto calculates the pro-rated leave entitlement based on the following condition.

If the employee is Manager he will be entitled to 16 days of annual leave but it has to be pro-rated in accordance to his join date and less than 2 years is 16 days, 2 years but less than 5years of service is 18 days, 5 years and above is 20 days.

While if the employee is Executive he will be entitled to 14 days of annual leave but same thing, the 14 days will be pro-rated in accordance to his join date when he first join the company. Less than 2 years is 14 days, 2 years but less than 5years of service is 16 days, 5 years and above is 18 days.

Need some help in this.

Thank you.

##### Well-known Member
I don't Understand what you say exactly. if means with workers less than 3 month working formula return zero.
Excel Formula:
``=If(G2<3,0,IF(F2="M",IF(G2<=24,16,IF(G2<=60,18,20)),IF(F2="ESO",IF(G2<=24,14,IF(G2<=60,16,18)),IF(F2="TFO",IF(G2<=24,10,IF(G2<=60,12,16)),IF(G2<=24,8,IF(G2<=60,10,12))))))``
If you want Use Column D not G then Change all G2 at formula to :
Excel Formula:
``MONTH(NOW()-D2)-1``

### Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

#### ambz123

##### Board Regular
Hi for instant a Staff joined on 5/10/2020, his Job Code is ESO his AL entitlement after 1 year is 14 days. It should return value as 3.5 as the number of month join is 3 months. How do i use the formula to return the value as 3.5?

how i get 3.5 is 3/12*14 = 3.5
=ROUND(IF(DATEDIF([@[JOIN DATE]],\$D\$2,"M")<3,0,IF(DATEDIF([@[JOIN DATE]],\$D\$2,"Y")<1,([@[AL Entitlement]]*(DATEDIF([@[JOIN DATE]],\$D\$2,"M"))/12),MIN(16,[@[AL Entitlement]]+((DATEDIF([@[JOIN DATE]],\$D\$2,"M")-12)/12))))/0.5,0)*0.5

I tried the above formula but it doesnt populated based on their job code instead i have to filter by their job code and amend one by one based on their job code. Is there anyway whereby i can add in the job code condition the the above formula so that it can return the accurate value based the condition of Job code, follow by years of entitlement, follow by pro-rated leave entitlement.

 Date Join Job Code No. of Months AL Entitlement Current Accrued 5/10/2020 ESO 3 Excel Formula: ``=DATEDIF([@[JOIN DATE]],TODAY(),"m")`` 14 3.5 Excel Formula: ``=ROUND(IF(DATEDIF([@[JOIN DATE]],\$D\$2,"M")<3,0,IF(DATEDIF([@[JOIN DATE]],\$D\$2,"Y")<1,([@[AL Entitlement]]*(DATEDIF([@[JOIN DATE]],\$D\$2,"M"))/12),MIN(16,[@[AL Entitlement]]+((DATEDIF([@[JOIN DATE]],\$D\$2,"M")-12)/12))))/0.5,0)*0.5``

#### ambz123

##### Board Regular
Hi i tried to upload but cant seems to work

#### Attachments

• Capture.PNG
29.6 KB · Views: 4

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,164,489
Messages
5,837,634
Members
430,506
Latest member
TonyIbbs

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back