DECIMAL Function (LibreOffice Calc)
The DECIMAL function converts a text representation of a number in any base (2–36) into its decimal (base‑10) numeric value. It is used in encoding, engineering, and arbitrary‑base conversions.
Compatibility
▾| Excel | ✔ |
| Gnumeric | ✔ |
| Google_sheets | ✔ |
| Libreoffice | ✔ |
| Numbers | ✔ |
| Onlyoffice | ✔ |
| Openoffice | ✖ |
| Wps | ✔ |
| Zoho | ✔ |
What the DECIMAL Function Does ▾
- Converts any base (2–36) → decimal
- Accepts text input (e.g.,
"FF","1011","7A3") - Supports negative values
- Supports alphanumeric digits (A–Z = 10–35)
- Ideal for encoding, engineering, and parsing arbitrary‑base data
Syntax ▾
DECIMAL(text; radix)
Arguments
-
text:
A string representing a number in the given base. -
radix:
The base of the input number (integer from 2 to 36).
Basic Examples ▾
Binary → decimal
=DECIMAL("1011"; 2)
→ 11
Hex → decimal
=DECIMAL("FF"; 16)
→ 255
Octal → decimal
=DECIMAL("377"; 8)
→ 255
Base‑36 example
=DECIMAL("Z"; 36)
→ 35
Advanced Examples ▾
Convert arbitrary alphanumeric codes
=DECIMAL("7A3"; 16)
→ 1955
Convert negative values
=DECIMAL("-1010"; 2)
→ -10
Convert a custom base‑32 identifier
=DECIMAL("1FQ"; 32)
Round‑trip with BASE()
=BASE(DECIMAL(A1; 16); 16)
Validate input before conversion
=IFERROR(DECIMAL(A1; B1); "Invalid")
Convert a whole column of encoded values
=ARRAYFORMULA(DECIMAL(A1:A20; 16))
Convert base‑5 to decimal
=DECIMAL("4312"; 5)
Edge Cases and Behavior Details ▾
DECIMAL returns a number, not text
Valid radix range
- Minimum: 2
- Maximum: 36
Valid characters
- Digits: 0–9
- Letters: A–Z (case‑insensitive)
- A = 10
- B = 11
- …
- Z = 35
Behavior details
- Leading/trailing spaces cause Err:502
- Invalid characters cause Err:502
- Negative values allowed
- Text must match the radix (e.g.,
"9"invalid in base 8)
Common Errors and Fixes ▾
Err:502 — Invalid argument
Cause:
- Character not valid for the given base
- Radix outside 2–36
- Non‑text input
- Empty string
Fix:
- Validate characters
- Ensure radix is between 2 and 36
- Wrap with TEXT() if needed
Wrong output
Cause:
- Misinterpreting letters (A–Z)
- Leading spaces
Fix:
- Use TRIM()
- Confirm base mapping
Best Practices ▾
- Use DECIMAL for general base conversion, not just binary/hex/octal
- Normalize input with TRIM()
- Use BASE() for reverse conversion
- Document radix assumptions in engineering models
- Validate user input with IFERROR
DECIMAL is the universal base‑to‑decimal converter — it replaces dozens of specialized functions and gives you full control over arbitrary‑base data.
Related Patterns and Alternatives ▾
- BASE — decimal → any base
- BIN2DEC / HEX2DEC / OCT2DEC — specialized converters
- DEC2BIN / DEC2HEX / DEC2OCT — decimal → other bases
- VALUE — convert numeric text to number
- TEXT functions — cleaning and normalization
By mastering DECIMAL, you unlock full arbitrary‑base conversion capabilities in LibreOffice Calc.