Round to the nearest half hour

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am making a query where I divde a field in my query (Week Hours) divided by
5 to get Daily Hours. I would like that number to be rounded to the nearest
half hour.

Example: 2.01-2.24=2
2.25-2.74=2.5
2.75-2.99=3

Any help would be greatly appreciated!
 
Hi,



0.5 * INT( 0.5+ value / CDec(0.5) )


Hoping it may help,
Vanderghast, Access MVP
 
I used what you give me, 0.5*INT(0.5+[Week Hours]/CDec(0.5)), and it told me
"The expression you entered has a function containing the wrong number of
arguments."
 
Hi,

The dot is decimal, not a list delimiter?


In the immediate (debug) window (Ctrl_G), try :

? 0.5* INT( 0.5 + 3.212 / CDec(0.5) )




It should return 3.


Hoping it may help,
Vanderghast, Access MVP


Tandy said:
I used what you give me, 0.5*INT(0.5+[Week Hours]/CDec(0.5)), and it told
me
"The expression you entered has a function containing the wrong number of
arguments."

Michel Walsh said:
Hi,



0.5 * INT( 0.5+ value / CDec(0.5) )


Hoping it may help,
Vanderghast, Access MVP
 

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

Back
Top