FORMATEX Function

Returns the result of expression evaluated in srcUnit as a string formatted according to format expressed in dstUnit.

Syntax

FORMATEX(expression," format ",[ srcUnit ],[ dstUnit ],[ langID ][, calID ])

Parameters

Name Required/Optional Data Type Description
expression
Required
String
A combination of constants, operators, functions, and references to ShapeSheet cells that results in a value.
format
Required
String
The format picture used to format the string. For more information about format pictures, see About Format Pictures.
srcUnit
Optional
String
Units used to evaluate expression (in, cm, and so forth).
dstUnit
Optional
String
Units to use for the result of expression (in, cm, and so forth).
langID
Optional
Number
The language used when formatting Microsoft Office System date/time pictures.
calID
Optional
Number
The calendar used when formatting Microsoft Office System date/time pictures.

Return value

String

Remarks

The type of the expression and the type specified in the format picture govern the behavior of the returned string. The format must be appropriate for the type of expression.

The srcUnit argument is used to scale untyped expression results, such as 3 + 4. If the result of expression has an explicit type, such as 3 ft + 8 ft, then srcUnit is ignored.

The dstUnit argument is used to specify the units used for the formatted result. If dstUnit is not specified, the units for the result of the expression are used.

Returns an error if the result of expression and the type expected in format are of a different kind, if there are syntax errors in format, or if it does not recognize the units passed as srcUnit or dstUnit.

Example

FORMATEX(5.5, "0.00 u", "cm", "ft")

Returns 0.18 feet.