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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I got probrems in rounding up numbers

Status
Not open for further replies.

icekube88

Programmer
Nov 27, 2003
16
PH
can u round this off to the nearest thousand
e.g

no = 13845

the result should be

14000

i try using round(13845,-3) i got an error
 
Hi and welcome to Tek-Tips. To get the best from the forum, please read faq222-2244, which helps you get the best answers.

For this one you will get quite close with:
[tt]
1000*Round(no/1000)
[/tt]
But remember that Round does statistical rounding, that is Round(2.5) becomes 2, but Round(3.5) becomes 4.

For consistent treatment use Int:[tt]

1000*(Int((no/1000) + .5))
[/tt]
which rounds all .5 up

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
C'mon Glasgow, speed up that keyboard [smile]

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Johnwm - I did mine suspended from the ceiling by a rope and drinking a pint of lager just for the challenge which explains the typing speed but not the omission (int etc). Perhaps I'll replace the rope with a second pint next time in case the rope is affecting my concentration.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top