FormatNumber

This function rounds decimal numbers up if the specified format uses fewer decimal points than the value itself and the remaining numbers are 5 or greater. The function rounds decimal numbers down if the specified format uses fewer decimal points than the value itself and the remaining numbers total less than 5. Integers outside the range of -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 print in scientific notation.

FormatNumber(1, 2, 3)

OrdinalTypeDescription
1numericRequiredValue to receive the specified formatting.
2stringRequiredValid format type value:
  • C - Currency
  • D - Decimal
  • E - Exponential
  • F - Fixed point
  • G - General
  • N - Number
  • P - Percent
  • R - Round-trip (format ensures value parsed to string can be parsed back to numeric value)
  • X - Hexadecimal
  • You can optionally follow this code with a number to indicate the precision of the number. For example, a currency value with a precision of 2 uses the parameter C2.
3stringCulture code used to indicate the correct date format

Example 1

System returns this value:

Example 2

System returns this value: