TONUMBER (Value, Locale?) TONUMBER (Value; Locale?)

Value

The value to convert.

Locale

Locale Locale (optional)

The locale to use when doing the conversion.

A locale represents a language and possibly a region. If omitted, the configured locale is used.

Use a value such as Locale.EnglishLocale,English to provide a locale (the full list is below). If your chosen locale is not part of the list, use the LOCALE function instead.

All locales may not be available. If a locale is not available, a fallback locale can be used. To provide such fallback locales, use the LOCALE function.

The LOCALE function accepts so-called Unicode Locale Identifiers. Every value in the list below corresponds to such an identifier.

Supported locales
Formula Unicode Locale Identifier Description
Locale.ArabicLocale,Arabic ar Arabic
Locale.BulgarianLocale,Bulgarian bg Bulgarian
Locale.ChineseCnLocale,ChineseCn zh-CN Chinese (simplified), as used in mainland China
Locale.ChineseTwLocale,ChineseTw zh-TW Chinese (traditional), as used in Taiwan
Locale.CroatianLocale,Croatian hr Croatian
Locale.CzechLocale,Czech cs Czech
Locale.DanishLocale,Danish da Danish
Locale.DutchLocale,Dutch nl Dutch
Locale.DutchBeLocale,DutchBe nl-BE Dutch, as used in Belgium
Locale.EnglishLocale,English en English
Locale.EnglishAuLocale,EnglishAu en-AU English, as used in Australia
Locale.EnglishCaLocale,EnglishCa en-CA English, as used in Canada
Locale.EnglishInLocale,EnglishIn en-IN English, as used in India
Locale.EnglishNzLocale,EnglishNz en-NZ English, as used in New Zealand
Locale.EnglishUkLocale,EnglishUk en-GB English, as used in the United Kingdom
Locale.EnglishUsLocale,EnglishUs en-US English, as used in the United States of America
Locale.EnglishZaLocale,EnglishZa en-ZA English, as used in South Africa
Locale.FinnishLocale,Finnish fi Finnish
Locale.FrenchLocale,French fr French
Locale.FrenchBeLocale,FrenchBe fr-BE French, as used in Belgium
Locale.FrenchCaLocale,FrenchCa fr-CA French, as used in Canada
Locale.FrenchChLocale,FrenchCh fr-CH French, as used in Switzerland
Locale.GermanLocale,German de German
Locale.GermanAtLocale,GermanAt de-AT German, as used in Austria
Locale.GermanChLocale,GermanCh de-CH German, as used in Switzerland
Locale.GreekLocale,Greek el Greek
Locale.HebrewLocale,Hebrew he Hebrew
Locale.HindiLocale,Hindi hi Hindi
Locale.HungarianLocale,Hungarian hu Hungarian
Locale.IndonesianLocale,Indonesian id Indonesian
Locale.ItalianLocale,Italian it Italian
Locale.ItalianChLocale,ItalianCh it-CH Italian, as used in Switzerland
Locale.JapaneseLocale,Japanese ja Japanese
Locale.KoreanLocale,Korean ko Korean
Locale.NorwegianLocale,Norwegian nb Norwegian (bokmål)
Locale.PersianLocale,Persian fa Persian
Locale.PolishLocale,Polish pl Polish
Locale.PortugueseLocale,Portuguese pt Portuguese
Locale.PortugueseBrLocale,PortugueseBr pt-BR Portuguese, as used in Brazil
Locale.RomanianLocale,Romanian ro Romanian
Locale.RussianLocale,Russian ru Russian
Locale.SlovakLocale,Slovak sk Slovak
Locale.SpanishLocale,Spanish es Spanish
Locale.SpanishArLocale,SpanishAr es-AR Spanish, as used in Argentina
Locale.SpanishEsLocale,SpanishEs es-ES Spanish, as used in Spain
Locale.SpanishMxLocale,SpanishMx es-MX Spanish, as used in Mexico
Locale.SwedishLocale,Swedish sv Swedish
Locale.ThaiLocale,Thai th Thai
Locale.TurkishLocale,Turkish tr Turkish
Locale.UkrainianLocale,Ukrainian uk Ukrainian
Locale.VietnameseLocale,Vietnamese vi Vietnamese

Returns

Number Number

A number corresponding to the given value.

Returns the given value converted to a number. TONUMBER ("42") TONUMBER ("42") returns 42.

When the sole parameter is a number, it is returned unchanged. When it is a logical value, FALSE is converted to 0 and TRUE is converted to 1.

When the value is a text string, a direct conversion is attempted (meaning that "42.1" is converted to 42.1), and an error is returned if the conversion is unsuccessful (meaning that "test" cannot be converted to a number, nor can "test4"). Spaces surrounding the number are ignored, and the empty text string is converted to 0.

The configured locale is taken into account when converting text strings, meaning that if said locale is German, a decimal comma (",") should be used as a decimal separator. If said locale is Australian English, a decimal point (".") should be used. Thousands separators must not be used and negative numbers must use a leading minus sign ("-").

Scientific notation is supported, meaning that the number may be followed by "e" and an exponent. "6.82e-7", for example, is interpreted as "6.82 times ten to the power of -7," which can be expressed as 6.82 * POWER (10, - 7)6,82 * POWER (10; - 7) in a formula.

Temporal values are converted to sequential serial numbers, which is the representation temporal values use internally. The conversion is exact, meaning that the resulting number can be converted back to the original temporal value using the TOTEMPORAL function.

Colors are converted as though the number is a raw color value. Such a value is a 32-bit number incorporating color components adhering to the ARGB color model. The least significant eight bits represent the blue color component, the next eight bits represent the green color component and the eight following bits represent the red color component. The most significant eight bits represent the alpha value, where a value of 0 means that the color is fully transparent and a value of 255 means that the color is fully opaque.

This function is not commonly supported by spreadsheets.

Examples

TONUMBER ("42.1")
TONUMBER ("42.1")

Returns 42.1, if the decimal separator of the configured locale is a decimal point. If the decimal separator is a decimal comma, an error is returned.

TONUMBER ("42,1")
TONUMBER ("42,1")

Returns 42.1, if the decimal separator of the configured locale is a decimal comma. If the decimal separator is a decimal point, an error is returned.

TONUMBER ("6,82e-7", Locale.German)
TONUMBER ("6,82e-7"; Locale,German)

Returns 0.000000682. The decimal comma is correctly interpreted as the locale is set to German.

TONUMBER ("$4,234.10")
TONUMBER ("$4,234.10")

Returns an error, because TONUMBER cannot handle leading units or thousands separators.

TONUMBER (FALSE)
TONUMBER (FALSE)

Returns 0.

TONUMBER (TRUE)
TONUMBER (TRUE)

Returns 1.

TONUMBER ( TOTEXT (2))
TONUMBER ( TOTEXT (2))

Returns 2.

fxEngine Shell Want this in your own terminal? A standalone version is coming. Get notified.
Loading fxEngine Shell