Question : Paid Time Off Accrual Formula

I've searched and have not found a soultion that fits my situation. I need a formula or VBA that will compute PTO hours earned since the anniversary date. Here is the criteria:

Cell C1 contains - date of  hire in xx/xx/xxxx format
Cell D1 contains  Months of service since hire date
Cell E1 contains  Anniversary Date in  xx/xx/xxxx format.
Cell F1 to contain solution - hours accrued since anniversary date through today

Time off is accrued at the following rates:
0  12 months of service  40 hours per year
13  96 months of service  80 hours per year
97  180 months of service  120 hours per year
181+ months of service  160 hours per year

So on 05/19/2008 all employees were paid out all accrued PTO. On 05/20/2008  all employees began accruing PTO starting at zero. However, service time (hire date) was not changed.

Say employee #1 has 240 months of service on the anniversary date, and is entitled to earn PTO at the rate of 160 hours per year.

Employee #2 has 179 months of service at the anniversary date (05/20/2008) and is entitled to earn PTO at the 120 hours per year rate, but on 07/30/2008, reaches 181 months of service, and is entitled to earn PTO at the 160 hours/year rate.

I hope you can see where this is going.

Thanks in advance

Answer : Paid Time Off Accrual Formula

There you go..i made a user defined function by the name of getamount and here it how it works...

=getamount(Your last paid date,balance till,Number of months in service)

So for Instance for row-12 it will be

=getamount(E12,$C$1,D12)

Now at the end of next month when it will be 181 months for the 12th row..and balance date at c1 will be 01/20/09...it gives you your desired result what you are looking for that is 83.33

Here is user defined function and workbook for your reference...To make it work hit on enable macros while opening the workbook..as userdeifned function goes into the vb module of the workbook..

Saurabh...

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
Function getamount(rng As Range, rng1 As Range, rng2 As Range)
    Dim i As Long, x As Long
    i = DateDiff("m", rng.Value, rng1.Value)
 
    For x = 1 To i
        Select Case rng2.Value - x
        Case Is <= 12
            getamount = getamount + (40 / 12)
        Case Is <= 96
            getamount = getamount + (80 / 12)
        Case Is < 180
            getamount = getamount + (120 / 12)
        Case Is >= 180
            getamount = getamount + (160 / 12)
        End Select
    Next x
 
End Function
Random Solutions  
 
programming4us programming4us