Rounding to nearest quarter

G

Guest

I am doing a vacation report that would give an employee vacation to the
nearest quarter hour of vacation.

My data in the query is:
43.08
92.31
111.54
106.42

I would like to round these hours of vacation to show as:

43.0
92.25
111.5
106.5

In the case of 92.31 the decimal is less than .37 (the median between .25
and .5) so we would round down to .25. In the case of 106.42 the decimal is
greater than .37 ( the same median) so we would round up. The same logic
would apply with the other quarter hours. For the life of me, I cant figure
this one out.

Thanks!
Barb
 
G

Guest

Try this and replace [Cost] with your field name.
To the quarter: Int(4*[Cost]+0.25)/4
 
G

Guest

Worked like a charm...THANKS!
Barb

KARL DEWEY said:
Try this and replace [Cost] with your field name.
To the quarter: Int(4*[Cost]+0.25)/4
--
KARL DEWEY
Build a little - Test a little


BAFFEE said:
I am doing a vacation report that would give an employee vacation to the
nearest quarter hour of vacation.

My data in the query is:
43.08
92.31
111.54
106.42

I would like to round these hours of vacation to show as:

43.0
92.25
111.5
106.5

In the case of 92.31 the decimal is less than .37 (the median between .25
and .5) so we would round down to .25. In the case of 106.42 the decimal is
greater than .37 ( the same median) so we would round up. The same logic
would apply with the other quarter hours. For the life of me, I cant figure
this one out.

Thanks!
Barb
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top