FORMATSCIENTIFIC function
Number
The number to format.
MinimumNumberOfDecimalPlaces
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
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
The leading unit that should precede the returned formatted number. If omitted, an empty text string is assumed.
TrailingUnit
The trailing unit that should follow the returned formatted number. If omitted, an empty text string is assumed.
Returns
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:
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:
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":
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:
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:
Use named parameters when they help make a formula easier to read.
Related functions
- Use FORMATNUMBER to format regular numbers.
- Use FORMATFRACTION to format fractions (0.75 can be formatted as "3/4").
- Use FORMATPERCENTAGE to format percentages (0.75 can be formatted as "75%").
- Use FIXED to round a number to the left of the decimal separator (7,523 can be formatted as "7,500").
- Use PARSESCIENTIFIC to turn the text returned from this function back into a number.
Examples
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
.
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
.
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.
Returns "3.50E+03" if the language of the app is set to US English, using exactly two decimal places.
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.
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.
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".
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".