VBScript Round Function
VB Script Tutorial | VB Script Usage | VB Script Variables | VB Script Procedures | VB Script Conditionals | VB Script Looping | VB Script Summary | VB Script Examples | VB Script Functions | VB Script Keywords The Round function rounds a number. The output of the above example: How to round a number to 2 decimal places: The output of the above example:VBScript Round Function
Syntax
Round(expression[,numdecimalplaces])
Parameter
Description
expression
Required. The numeric expression that needs to be rounded.
numdecimalplaces
Optional. Specifies how many digits to round to the right of the decimal point. Default is 0.
Examples
Example 1
<script type="text/vbscript">
document.write(Round(24.13278) & "<br />")
document.write(Round(24.75122))
</script>
Try it Yourself
24
25
Example 2
<script type="text/vbscript">
document.write(Round(24.13278,2))
</script>
Try it Yourself 24.13
YouTip