BIN2DEC Function (LibreOffice Calc)
The BIN2DEC function converts a binary (base‑2) number into its decimal (base‑10) equivalent. Supports signed 10‑bit binary values using two’s complement.
Compatibility
▾| Excel | ✔ |
| Gnumeric | ✔ |
| Google_sheets | ✔ |
| Libreoffice | ✔ |
| Numbers | ✖ |
| Onlyoffice | ✔ |
| Openoffice | ✔ |
| Wps | ✔ |
| Zoho | ✔ |
What the BIN2DEC Function Does ▾
- Converts binary → decimal
- Accepts up to 10 bits
- Supports signed values using two’s complement
- Useful for bitwise workflows, encoding, and low‑level data processing
Syntax ▾
BIN2DEC(binary_number)
Arguments
- binary_number:
A text string representing a binary number (e.g.,"1011").
Basic Examples ▾
Convert simple binary to decimal
=BIN2DEC("1010")
→ 10
Convert using a cell reference
=BIN2DEC(A1)
Convert a signed 10‑bit binary number
=BIN2DEC("1111111111")
→ -1
Advanced Examples ▾
Convert a binary value stored as text
=BIN2DEC(TEXT(A1; "0000000000"))
Convert a binary result from BIT* functions
=BIN2DEC(BASE(BITOR(A1; A2); 2; 10))
Convert a padded binary string
=BIN2DEC(RIGHT("0000000000" & A1; 10))
Convert a two’s‑complement negative number
=BIN2DEC("1111110110")
→ -10
Convert a binary string generated from DEC2BIN
=BIN2DEC(DEC2BIN(A1; 10))
Edge Cases and Behavior Details ▾
BIN2DEC returns a numeric value
Accepts:
- Binary strings up to 10 bits
- Signed values using two’s complement
- Leading zeros
Behavior details
- Maximum unsigned input:
"1111111111" - Two’s complement range:
- Minimum: –512
- Maximum: +511
- Input must be text or a number containing only 0s and 1s
- Negative values require full 10‑bit representation
Invalid input → Err:502
BIN2DEC of an error → error propagates
Common Errors and Fixes ▾
Err:502 — Invalid binary number
Cause:
- Contains characters other than 0 or 1
- More than 10 bits
- Empty string
Fix:
- Validate input
- Use TEXT or RIGHT to enforce 10‑bit width
Unexpected negative result
Cause:
- Input interpreted as two’s complement
Fix:
- Ensure correct bit width
- Use DEC2BIN for consistent formatting
Best Practices ▾
- Always pad binary values to 10 bits for predictable signed behavior
- Use DEC2BIN for generating compatible binary strings
- Combine with BIT* functions for bitwise workflows
- Validate input to avoid Err:502
- Use BASE for arbitrary‑length binary conversions
BIN2DEC is your reliable bridge between binary and decimal — essential for bitwise operations, encoding, and low‑level numeric workflows.
Related Patterns and Alternatives ▾
- Use DEC2BIN for decimal → binary
- Use BIN2OCT and BIN2HEX for other base conversions
- Use BASE for arbitrary‑length binary strings
- Use VALUE to sanitize imported text
By mastering BIN2DEC and its companion functions, you can build powerful binary‑processing and encoding workflows in LibreOffice Calc.