If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Date Calculations for Staff
We have an extensive Database which handles Staff earned Leave
(Personal & Sick). Everyone gets the same amount of Sick leave each month- so that is easy. However the amount of persoanl leave earned is depending on years of service. So I have three calculations each month to determine leave earned. The first determines the number of years they have worked with us. so for December : DecYr: (#12/1/2004#-[LGD])/365 The second then evaluates the amount of leave earned based on the above calculation. VTDec: IIf([SepYr]=35,21,IIf([SepYr]=30,19,IIf([SepYr]=25,17,IIf([SepYr]=20,15,IIf([SepYr]=15,13,IIf([SepYr]=10,11,IIf([SepYr]=5,10,IIf([SepYr]=2,9,IIf([SepYr]2,8))))))))) The third kicks in the leave amount when todays date reaches the 1st of the month. DecVL: IIf([TDate]=#12/1/2004#,[VTSep],0) This all works very cleanly, every month the leave is calculated, no problem..... Except the rule says you do not earn the new leave amount unless you started work on the 1st. So if you started on the Dec.3rd of the month, and its your 5 yr of work, you don't go from 9 hrs earned to 10 hrs until the following month. But my calculations says you are at 5.00 years as of Dec. 1st. But it should be earned by Jan. Leap years makes my calculations err. So if I make a change to the formulas, does anyone have a suggestion. |
#2
|
|||
|
|||
try
DecYr: IIf(Day([LGD]) 1, (DateDiff("m", [LGD], #12/1/2004#) / 12) - 1, DateDiff("m", [LGD], #12/1/2004#) / 12) hth wrote in message oups.com... We have an extensive Database which handles Staff earned Leave (Personal & Sick). Everyone gets the same amount of Sick leave each month- so that is easy. However the amount of persoanl leave earned is depending on years of service. So I have three calculations each month to determine leave earned. The first determines the number of years they have worked with us. so for December : DecYr: (#12/1/2004#-[LGD])/365 The second then evaluates the amount of leave earned based on the above calculation. VTDec: IIf([SepYr]=35,21,IIf([SepYr]=30,19,IIf([SepYr]=25,17,IIf([SepYr]=20,15, IIf([SepYr]=15,13,IIf([SepYr]=10,11,IIf([SepYr]=5,10,IIf([SepYr]=2,9,IIf ([SepYr]2,8))))))))) The third kicks in the leave amount when todays date reaches the 1st of the month. DecVL: IIf([TDate]=#12/1/2004#,[VTSep],0) This all works very cleanly, every month the leave is calculated, no problem..... Except the rule says you do not earn the new leave amount unless you started work on the 1st. So if you started on the Dec.3rd of the month, and its your 5 yr of work, you don't go from 9 hrs earned to 10 hrs until the following month. But my calculations says you are at 5.00 years as of Dec. 1st. But it should be earned by Jan. Leap years makes my calculations err. So if I make a change to the formulas, does anyone have a suggestion. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
QDE (Quick Date Entry) | Norman Harker | Worksheet Functions | 37 | September 5th, 2004 01:24 AM |
QDE (Quick Date Entry) | Norman Harker | General Discussion | 3 | September 3rd, 2004 08:00 AM |
Date calculations in Access ? | Andres | General Discussion | 5 | July 8th, 2004 01:40 AM |
Formatting dates in Excel | bernrunner15 | New Users | 4 | May 11th, 2004 10:32 PM |
Does date fall between two ranges? | MR | Worksheet Functions | 4 | January 14th, 2004 04:08 PM |