Documentation/Calc Functions/BASE/en

Function name:
BASE

Category:
Text

Summary:
Converts a non-negative integer to a text representation in a specified base / radix. The minimum number of characters in the text representation can be specified, in which case leading zeroes are added if required. The characters 0-9 and uppercase A-Z are used as the “digits” in the returned text.

The BASE function is complementary to the DECIMAL function.

Syntax:
BASE(Number; Radix[; MinimumLength])

Returns:
Returns a text string representing the given number in the specified base / radix

Arguments:
Number is a non-negative integer, or a reference to a cell containing a non-negative integer, that is to be converted to a text representation.

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 text representation.

MinimumLength is a non-negative integer, or a reference to a cell containing a non-negative integer, that is the minimum number of characters to appear in the text representation. If MinimumLength is omitted, the returned text comprises the least number of characters without any leading zeroes. If a valid value of MinimumLength is specified but is less than or equal to the smallest number of characters needed, then it is ignored; leading zeroes are added if MinimumLength is valid and greater than the smallest number of characters needed.


 * If any of Number, Radix, or MinimumLength is non-numeric, then BASE reports a #VALUE! error.
 * For any non-integer value of Number, Radix, or MinimumLength, BASE truncates the value to an integer.
 * If, after any truncation, either Number or MinimumLength is less than 0, then BASE reports an invalid argument error (Err:502).
 * If, after any truncation, Radix is less than 2 or greater than 36, then BASE reports an invalid argument error (Err:502).

Additional details:
BASE generates text representations of non-negative integer numbers for any base in the range 2 to 36, using the 10 digits (0-9) and 26 uppercase letters (A-Z) of the modern English alphabet. The positional numeral systems for each base have been given names that are listed on Wikipedia's List of numeral systems page. Some of the more commonly used are:


 * Base 2 – binary, using the digits 0 and 1.
 * Base 8 – octal, using the digits 0 to 7.
 * Base 10 – decimal, using the digits 0 to 9.
 * Base 16 – hexadecimal, using the digits 0 to 9 and characters A (10) to F (15).
 * Base 32 – duotrigesimal, using the digits 0 to 9 and characters A (10) to V (31).
 * Base 36 – hexatrigesimal, using the digits 0 to 9 and characters A (10) to Z (35).

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

Related LibreOffice functions:
DECIMAL

ODF standard:
Section 6.19.3, part 2

Equivalent Excel functions:
BASE