YouTip LogoYouTip

Func Round

VBScript Round Function

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

VBScript Round Function

The Round function rounds a number.

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>

The output of the above example:

 24
 25 
Try it Yourself

Example 2

How to round a number to 2 decimal places:

<script type="text/vbscript">

document.write(Round(24.13278,2))

</script>

The output of the above example:

 24.13 
Try it Yourself
← Func ScriptengineFunc Rgb β†’