DECIMAL Function (OpenOffice Calc)
Read unsigned positional strings with OpenOffice DECIMAL, including hexadecimal prefixes, binary suffixes, whitespace rules and contrasts with signed HEX2DEC.
Verification status: Eight reference formulas and 10 diagnostic cases were recalculated in Apache OpenOffice 4.1.16 on Linux x86-64, Build 9816, using generated native ODF and GUI hard recalculation. Saved formula identities and typed results were checked; the load warning is described below. How formula examples are checked
Quick answer: =DECIMAL("Z";36) returned 35 in the tested Apache OpenOffice 4.1.16 build.
Availability and version history
- Introduced: First release not established; documented by OpenOffice.org 3.3.
- Supported in: Apache OpenOffice 4.1.16; this identifies a verified release, not a final supported version.
- Scope: Desktop Calc, English function names and semicolon-separated formulas.
- Checked: October 14, 2026. Eight reference formulas and the listed diagnostics were recalculated from generated native ODF in 4.1.16 on Linux x86-64, Build 9816. Source and independent reference calculations were also checked.
What DECIMAL returns
DECIMAL reads a numeral in a selected base and returns a number. It supports radices 2 through 36, treating letters A–Z as digits 10–35 and accepting lowercase equivalents. It does not interpret a sign character as part of an ordinary negative numeral. Release entry.
Syntax and arguments
=DECIMAL(Text; Radix)
Supply exactly two arguments. Text is the numeral string and Radix determines the permitted digits. Radix is approximately floored before the 2–36 domain check. The parser skips leading ASCII spaces and tabs, then applies its base-specific prefix and suffix rules. An empty string returns zero.
Reproducible examples
The native column records the saved 4.1.16 results. The independent values use high-precision mathematics; displayed decimals are rounded to twelve places. Integer results remain exact in these small cases.
| Formula | Native 4.1.16 result | Independent reference |
|---|---|---|
=DECIMAL("101010";2) |
42 |
42 |
=DECIMAL("52";8) |
42 |
42 |
=DECIMAL("2A";16) |
42 |
42 |
=DECIMAL("Z";36) |
35 |
35 |
=DECIMAL("FF";16) |
255 |
255 |
=DECIMAL("100";8) |
64 |
64 |
=DECIMAL("0001";10) |
1 |
1 |
=DECIMAL("FFFFFFFFFF";16) |
1099511627775 |
1099511627775 |
Practical worksheet
Suppose A2 contains the text 2A from a device log. =DECIMAL(A2;16) gives 42. Fill the formula down a column of hexadecimal codes while retaining the original strings. Quote a direct literal as =DECIMAL("2A";16) rather than allowing Calc to treat it as a name.
A status formula such as =IF(A2="";"Missing";IFERROR(DECIMAL(A2;16);"Invalid")) distinguishes an empty source from a genuine zero and an invalid record. Whether spaces should be cleaned is a data-import decision; keep the original text for audit.
Advanced interpretation and checks
For a base-to-base conversion, =BASE(DECIMAL("2A";16);2;8) returns 00101010. The inner call reads hexadecimal and the outer call writes binary. The width is an output-format requirement and belongs to BASE.
DECIMAL uses unsigned positional magnitude. The ten-character string FFFFFFFFFF in base 16 is 1099511627775 here, while the specialized HEX2DEC signed-width convention interprets that pattern as −1. Choose a decoder from the data format, not merely from the fact that both inputs are hexadecimal.
The parser accepts a hexadecimal x or 0x prefix and a final h; binary may have a final b. The listed 0xFF, FFh and 101b cases confirm these conventions. A leading ASCII space is skipped, but a trailing space is not. These rules should not be generalized to arbitrary punctuation, Unicode whitespace or signed strings.
Boundaries and troubleshooting
=DECIMAL("-1";16) errors; it does not produce −1. Likewise digit 2 is invalid in base 2. Missing Radix is a different error from invalid text. Fractional Radix 16.9 is converted to 16 in the observed case. Very long digit sequences can exceed exact floating-point integer precision even if the parser returns a finite number; the successful examples here do not establish exact parsing of arbitrary-length identifiers.
These additional formulas were recalculated from the same generated ODF input. Error displays are retained as errors, even when an ODS numeric attribute stores zero.
| Formula | Observed result or error |
|---|---|
=DECIMAL("0xFF";16) |
255 |
=DECIMAL("FFh";16) |
255 |
=DECIMAL("101b";2) |
5 |
=DECIMAL(" FF";16) |
255 |
=DECIMAL("FF ";16) |
Err:502 |
=DECIMAL("-1";16) |
Err:502 |
=DECIMAL("";16) |
0 |
=DECIMAL("2";2) |
Err:502 |
=DECIMAL("FF";16.9) |
255 |
=DECIMAL("FF") |
Err:511 |
Related functions
Official evidence and checking scope
The generated ODF input produced the informational load warning “Not all attributes could be read.” After it was acknowledged, the sheet was hard-recalculated and saved separately. Every formula identity, input label and tested result was reconciled, including repeated spaces represented with ODF text elements. This does not certify every style attribute. The separately prepared XLSX input was not executed. A deliberately stale SUM cache changed from 999999 to 3, and an uncached SUM returned 7 after hard recalculation. Native evidence covers the eight reference formulas and listed diagnostics only. Other explanatory compositions are independent mathematical checks; other releases, locales and extreme-value behavior were not established by this run.