Documentation/Calc Functions/DECIMAL/en

Function name:
DECIMAL

Category:
Text

Summary:
Converts the text representation of a number in a specified base / radix to a decimal number.

The DECIMAL function is complementary to the BASE function.

Syntax:
DECIMAL(Text; Radix)

Returns:
Returns a non-negative integer that is the decimal number obtained by converting the specified text string using the given base / radix.

Arguments:
Text is a string (in quotation marks), or a reference to a cell containing that string, that contains the characters of the number that is to be converted to decimal. For any valid value of the Radix argument, if the value to be converted only contains digits (0 to 9) then it may also be passed as a number or a reference to a cell containing that number. In such a case, the content of Text may appear to be decimal but DECIMAL will interpret it correctly in its intended base.

Radix is an integer in the range 2 ≤ r ≤ 36, or a reference to a cell containing such an integer, that is the base / radix to be used for the conversion.


 * If Text contains a character that is not valid for the specified Radix, then DECIMAL reports an invalid argument error (Err:502). The following rules govern the validity of the characters in Text.
 * Leading space and tab characters are valid and ignored.
 * Leading zeroes are valid and ignored.
 * Where letters can appear within Text, both uppercase and lowercase letters are accepted and treated as equals.
 * The following table lists the characters allowed in Text for each base. For brevity, only the uppercase letters are listed in the table.


 * If Text is set to the empty string, DECIMAL returns 0 for any valid value of Radix.
 * If Radix is non-numeric, then DECIMAL reports a #VALUE! error.
 * For any non-integer value of Radix, DECIMAL truncates the value to an integer.
 * If, after any truncation, Radix is less than 2 or greater than 36, then DECIMAL reports an invalid argument error (Err:502).

Additional details:
The positional numeral systems for each base have been given names that are listed on Wikipedia's List of numeral systems page.

For a non-negative integer x and a valid base b, note that.

Related LibreOffice functions:
BASE

ODF standard:
Section 6.19.10, part 2

Equivalent Excel functions:
DECIMAL