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!

Using the ROUND function similar to MS Excel 1

Status
Not open for further replies.

pnad

Technical User
May 2, 2006
133
US
Hello all,

I need to use the ROUND function in ASP similar to the functionality of ROUND in excel. Basically, I need to be able to pass -ve numbers as number of decimal places.

E.g.

ROUND in excel
round(-182294.81,-5) = -200000

How do I accomplish this using javascript/vbscript or any in-built ASP functions.

All help is appreciated.

Thanks.
 
Roughly this, with m positive or negative alike.
[tt]
m=-5
n=-182294.81
p=round(n*10^m)*10^(-m)
[/tt]
 
Thank you all. I was able to use the formula successfully.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top