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 Chriss Miller 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.

psimon1

Technical User
Mar 18, 2003
55
US
Hello

I'm trying to add a rounding calc in a report or a query (and then a report). The query pulls a salary such as 24,525 from a table in the dB and I'm trying to have the system automatically return 25,000. 24,444 would go to 24,000. The report is based on the query. I've played with mround, roundup, and a few others but am having some trouble. Any sage advice?

Thanks,

ps
 
psimon

A simple search on Keyword: rounding, pulled up several threads. One of them may answer your question.

thread181-456869


Vic
 
I wrote an FAQ on this in this forum

faq701-3133

I didn't carry out the rounding to the 10Kth but the info there should get you going in the right direction. Post back if you have problems.

Paul
 
Thanks, Paul. This is a work in progress

rounded salary: Int(((Int([my value])/10000)+0.05)*1000)*10

for 23560 returned 24,000. That's great!

But for 21052 it returned 21550. I would like it to return 21000.

Any other ideas?

Thank you

Phil
 
I couldn't resist working on it myself.
Int((Int([NumberField]) / 1000) + 0.5)* 1000

24525 returns 25000
24444 returns 24000

Basically this will preform rounding for all number greater than 1000.

Paul
 
Final question:

What if I always wanted it to round up to the next 1000? 21,001 would become 22,000 and 21999 would as well?

Thanks.
 
Int((Int([NumberField]) / 1000) + 0.9999)* 1000

21000 stays 21000
21001 becomes 22000
21999 becomes 22000


Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top