FORMATPERCENT(expression [,numdigitsafter] [,includeleadingdigit] [,negativeuseparens] [,groupdigits])

Returns the expression formatted as a percentage (String).


expressionThe expression to be formatted.
numdigitsafter(Optional) The number of places to the right of the decimal place.
includeleadingdigit(Optional) A vbTriState constant specifying if to include leading zeros (Integer):
-1 = vbTrue
0 = vbFalse
1 = vbUseDefault
useparensfornegativenumbers(Optional) A vbTriState constant specifying how to display negative numbers (Integer):
-1 = vbTrue
0 = vbFalse
1 = vbUseDefault
groupdigits(Optional) A vbTriState constant specifying if numbers are grouped (Integer):
-1 = vbTrue
0 = vbFalse
1 = vbUseDefault

REMARKS
* The "expression" is formatted as a percentage (multiplied by 100) with a trailing % characters.
* If "numdigitsafter" is left blank, then 2 is used.
* If "includeleadingdigit" is left blank, then vbTrue is used.
* If "useparensfornegativenumbers" is left blank, then vbFalse is used.
* If "groupdigits" is left blank, then vbTrue is used.
* This function was added in Office 2000.
* The equivalent .NET function is Microsoft.VisualBasic.Strings.FormatPercent
* For the Microsoft documentation refer to docs.microsoft.com

Debug.Print FormatPercent(123.456) 
Debug.Print FormatPercent(123.456, 3)
Debug.Print FormatPercent(0.456, , vbFalse)
Debug.Print FormatPercent(-40.456, , , vbTrue)
Debug.Print FormatPercent(1000000, , , , vbFalse)

© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited Top