FORMATSCIENTIFIC function

FORMATSCIENTIFIC(Number, MinimumNumberOfDecimalPlaces?, MaximumNumberOfDecimalPlaces?, LeadingUnit?, TrailingUnit?) FORMATSCIENTIFIC(Number; MinimumNumberOfDecimalPlaces?; MaximumNumberOfDecimalPlaces?; LeadingUnit?; TrailingUnit?)

Number

Number or { Number }

The number to format.

MinimumNumberOfDecimalPlaces

Number or { Number } (optional)

The minimum number of decimal places a number should be formatted with. Must be greater than or equal to zero and less than or equal to the maximum number of decimal places. If both this parameter and the maximum number of decimal places parameter are omitted, zero is assumed. Otherwise, two is assumed.

MaximumNumberOfDecimalPlaces

Number or { Number } (optional)

The maximum number of decimal places a number should be formatted with. Must be less than or equal to the maximum number of decimal places. If omitted, this parameter is set to the minimum number of decimal places.

LeadingUnit

Text or { Text } (optional)

The leading unit that should precede the returned formatted number. If omitted, an empty text string is assumed.

TrailingUnit

Text or { Text } (optional)

The trailing unit that should follow the returned formatted number. If omitted, an empty text string is assumed.

Returns

Text or { Text }

A number formatted using scientific notation.

Returns a number formatted using scientific notation. FORMATSCIENTIFIC(3500.5)FORMATSCIENTIFIC(3500,5) returns "3.5005E+03", if the language of the app is set to US English, which should be interpreted as 3.5005 * 10^33,5005 * 10^3. Scientific notation is an effective means of conveying very small or very large numbers.

FORMATSCIENTIFIC takes the language of the app into account when converting numbers. For instance, a decimal point is used when the language is set to US English and a decimal comma is used when the language is set to French.

This function is specific to Calcapp.

Decimal places

The second and third parameters are used to control the number of decimal places the number is formatted with. If only the second parameter is given, it specifies the exact number of decimal places that are used.

This formula returns "3.50E+03", using exactly two decimal places:

FORMATSCIENTIFIC(3500.5, 2)FORMATSCIENTIFIC(3500,5; 2)

If a third parameter is given, the second parameter is interpreted as the minimum number of decimal places that should be used and the third parameter is interpreted as the maximum number of decimal places that should be used.

This formula uses between 2 and 6 decimal places:

FORMATSCIENTIFIC(3500, 2, 6)FORMATSCIENTIFIC(3500; 2; 6)

As 3500 is an integer and no decimal places are required, "3.50E+03" is returned (for US English).

However, if the first parameter is set to 3500.1234567893500,123456789, "3.500123E+03" is returned. The returned value respects the maximum number of decimal places to use, which is set to 6.

Leading and trailing units

The remaining parameters, LeadingUnit and TrailingUnit, are used to specify units. " lbs", " kg" and the like can be used as trailing units, for instance.

For a US English app, this formula returns "3.50E+04 lbs":

FORMATSCIENTIFIC(35000, 2, 2, "", " lbs")FORMATSCIENTIFIC(35000; 2; 2; ""; " lbs")

Named parameters

When a large number of parameters are provided to FORMATSCIENTIFIC, it can be hard to keep track of which values go with which parameters. To make this easier, a parameter name, followed by :, may precede its value.

These formulas are equivalent:

FORMATSCIENTIFIC(35000, 0, 0, "", " lbs")FORMATSCIENTIFIC(35000; 0; 0; ""; " lbs")
FORMATSCIENTIFIC(Number: 35000, MinimumNumberOfDecimalPlaces: 0, MaximumNumberOfDecimalPlaces: 0, LeadingUnit: "", TrailingUnit: " lbs")FORMATSCIENTIFIC(Number: 35000; MinimumNumberOfDecimalPlaces: 0; MaximumNumberOfDecimalPlaces: 0; LeadingUnit: ""; TrailingUnit: " lbs")

All parameters don't need to be named, but once a parameter has been named, the remaining parameters must also be named.

Named parameters make it possible to provide parameters out-of-order and to omit optional parameters that normally would have been expected to precede a parameter, had it not been named. Omitted optional parameters use default values.

The formula above uses default values for all parameters other than Number and TrailingUnit. As such, those optional parameters can be removed from the formula:

FORMATSCIENTIFIC(35000, TrailingUnit: " lbs")FORMATSCIENTIFIC(35000; TrailingUnit: " lbs")

Use named parameters when they help make a formula easier to read.

Related functions

Examples

FORMATSCIENTIFIC(3500.5)FORMATSCIENTIFIC(3500,5)

Returns "3.5005E+03" if the language of the app is set to US English, which should be interpreted as 3.5005 * 10^33,5005 * 10^3. Numbers in formulas can also be written using scientific notation, meaning that 3500.5 in this formula can also be written as 3.5005e3.

FORMATSCIENTIFIC(0.0035005)FORMATSCIENTIFIC(0,0035005)

Returns "3.5005E-03" if the language of the app is set to US English, which should be interpreted as 3.5005 * 10^-33,5005 * 10^-3. Numbers in formulas can also be written using scientific notation, meaning that 0.0035005 in this formula can also be written as 3.5005e-3.

FORMATSCIENTIFIC({ 3500.5, 0.00035 }, 2)FORMATSCIENTIFIC({ 3500,5; 0,00035 }; 2)

Returns the array { "3.50E+03", "3.50E-04" }{ "3.50E+03"; "3.50E-04" } if the language of the app is set to US English. The number of decimal places is set to 2. When invoked with an array, FORMATSCIENTIFIC is invoked once per array element and the results are collected in an array.

FORMATSCIENTIFIC(3500.5, 2)FORMATSCIENTIFIC(3500,5; 2)

Returns "3.50E+03" if the language of the app is set to US English, using exactly two decimal places.

FORMATSCIENTIFIC(3500, 2, 6)FORMATSCIENTIFIC(3500; 2; 6)

Returns "3.50E+03" if the language of the app is set to US English. As both the second and the third parameter are specified, 2 is taken to mean the minimum number of decimal places that should be used, and 6 is taken to mean the maximum number of decimal places that should be used.

FORMATSCIENTIFIC(3500.123456789, 2, 6)FORMATSCIENTIFIC(3500,123456789; 2; 6)

Returns "3.500123E+03" if the language of the app is set to US English. As both the second and the third parameter are specified, 2 is taken to mean the minimum number of decimal places that should be used, and 6 is taken to mean the maximum number of decimal places that should be used.

FORMATSCIENTIFIC(35000, 2, 2, "", " lbs")FORMATSCIENTIFIC(35000; 2; 2; ""; " lbs")

Returns "3.50E+04 lbs" (for an app set to US English). Here, the leading unit is set to the empty text string, and the trailing unit to " lbs".

FORMATSCIENTIFIC(35000, 2, 2, TrailingUnit: " lbs")FORMATSCIENTIFIC(35000; 2; 2; TrailingUnit: " lbs")

Returns "3.50E+04 lbs" (for an app set to US English). Here, the leading unit is omitted, and the trailing unit is set to " lbs".