CFLib.org – Common Function Library Project

Percentage(value, maximum)

Last updated September 06, 2001

author

Jennifer Larkin

Version: 1 | Requires: CF5 | Library: MathLib

Description:
Divides value by maximum, multiplies the result by 100, and returns the percenage. Returns repeating decimals to ten decimal places.

Return Values:
Returns the percentage.

Example:

<cfoutput>
Your score is #Round(percentage(1,3))# %.
</cfoutput>

Parameters:

Name Description Required
value The value. Yes
maximum The maximum value. Yes

Full UDF Source:

/**
 * Returns the percentage of value out of maximum.
 * 
 * @param value      The value. 
 * @param maximum      The maximum value. 
 * @return Returns the percentage. 
 * @author Jennifer Larkin (mr_urc@drule.org) 
 * @version 1, September 6, 2001 
 */
function percentage(Value,Maximum) {
  return ((Value/Maximum)*100);
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson