SQL PHP HTML ASP JavaScript articles and free scripts to download
 

ASP percentage value by using FormatPercent function

We can get the percentage of two numbers by using ASP function FormatPercent(). We can use this function to get the percentage and we can format the output as per our requirement. Here is the syntax of FormatPercent function.

FormatPercent(n1/n2,d3)


Here n1 and n2 are two variables and d3 is the number specifying number of decimal places required. d3 is an optional value we can specify as the number of decimal places we want. Default value for this is 2.

Here is an example of FormatPercent function.

Dim my_num
my_num=FormatPercent(11/203,6) ' Output is 5.418719%
Response.Write my_num


one more example without using optional value for decimal places

Dim my_num
my_num=FormatPercent(11/203) ' Output is 5.42%
Response.Write my_num
Further readings
Round function to format decimal place in a number
Math functions INT
Random Number generator using Random function
Percentage value by using FormatPerecnt function
 
Scripts
PHP
JavaScript
All ASP Tutorials
Popular Tutorials
Managing two drop downs
ASP Tutorials
Date and time
Declaring array
Form in ASP
Server.MapPath
Date Time & MSSQL
Select Query
File System Object
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.