Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rounding

Status
Not open for further replies.

DJMIKEDEE

Technical User
May 17, 2002
4
DE
Hello Helper,
I am a Admin pay clerk who calculates Local Civilians pay. Even thou we do have a good pay system, we do have calculate some groups manually, believe me it can be a pain, so I have come up with an idea to build a database with access97.

The problem I have is………..
We work on an Industrial clock I.e. weekly hours 38:30 =38.50 /5 days= 7.7 hours a day X the monthly working days (maybe 23)=177.10
But we can only process in???.00, ???.25,???.50 and???.75

The biggest problem I find are the part timers who only work maybe 18 hours a week which brings it up to 3,6 hours a day

For exsample:
18/5=3.6*23=82.8 Need to round to 82.75

38.5/5=7.7*23=177.10 Needs to round to 177.00
21/5=4.2*23=96.6 Needs to round to 96.5

Can you please help me with a solution to this problem.

Looking forward to your helping answer
 
It looks like you always round down to the nearest 1/4.

If this is so, you can use the following expression to return the result (let's say you have already calculated the hours worked, and called it "hours"):

RoundedHours: IIf([hours]-Int([hours])>0.749,Int([hours])+0.75,IIf([hours]-Int([hours])>0.499,Int([hours])+0.5,IIf([hours]-Int([hours])>0.249,Int([hours])+0.25,Int([hours]))))

Note - add "9"s to the comparative expressions depending on how accurate you wish to round to, eg for four decimal places, say >0.7499; for 5 decimal places, say >0.74999 etc etc. Otherwise 0.7495 (for example) may get rounded down to 0.5...

Disclaimer: I don't know of a built-in function that will take care of this for you... others may do though :)

Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top