Contact

DEC2BIN Function (Calligra Sheets)

Engineering Intermediate Calligra Sheets

Turn decimal integers into binary text in Calligra Sheets, with minimum-width padding, reversible IDs and negative/fractional input checks.

Verification status: Selected formulas were executed through the Calligra Sheets 25.04.2 calculation engine library. No workbook-import or GUI-cell result is claimed; 26.08.2 was source-checked only. How formula examples are checked

Quick answer: =DEC2BIN(13;8) gives 00001101 in the tested Calligra calculation engine. Successful DEC2BIN results are text strings.

Availability and version history

  • Introduced: First release not established; the name is present in Calligra 2.4.0 source.
  • Supported in: Calligra Sheets 26.08.2, with no retirement established.
  • Scope: Desktop Sheets with the Engineering function module. Examples use English semicolon-separated formulas.
  • Checked: October 14, 2026. Formulas were executed through the official 25.04.2 engine library, with source and independent arithmetic checks. This is not GUI-cell or workbook-import evidence; 26.08.2 was source-checked, not executed.

What the result represents

DEC2BIN converts the value of a decimal integer into a base-2 text string. Binary digits count powers of two, so 13 becomes 1101. A width argument can add leading zeroes without changing the encoded integer. Function help.

Syntax and arguments

=DEC2BIN(number[;places])

Number is required; places is an optional minimum output length. Although the short help syntax shows only one argument, the registered function accepts one or two. For reliable conversion use a nonnegative integer and a nonnegative integer width. The wrapper checks that its string representation contains decimal digits only. Brackets mark optional arguments and are not entered in a formula. Registration, implementation and versioned help.

Reproducible engine examples

These outputs were obtained through Calligra 25.04.2’s Formula parser and calculation library. The ordinary conversions also match independent positional arithmetic. Backticks preserve literal leading zeroes; they are not part of the entered result.

Formula Engine result
=DEC2BIN(0) 0
=DEC2BIN(1) 1
=DEC2BIN(5) 101
=DEC2BIN(13;8) 00001101
=DEC2BIN(255) 11111111
=DEC2BIN(16;2) 10000
=DEC2BIN(511) 111111111
=DEC2BIN(512) 1000000000

Practical worksheet

Put 13 in A2 and 8 in B2. Enter =DEC2BIN(A2;B2) to obtain 00001101. This is useful when displaying an eight-position bit field. In this example the set positions have weights 8, 4 and 1; all other positions are zero. Format or import the resulting field as text when another application needs to retain those leading zeroes.

Advanced checks and field widths

The recorded check =BIN2DEC(DEC2BIN(13;8)) returns numeric 13. Reversibility checks the value, while the original text retains the width. An eight-digit nonnegative binary field covers 0 through 255. The implementation also returns 1000000000 for 512, so do not infer a signed ten-bit limit from another spreadsheet’s DEC2BIN rules.

If places is shorter than the necessary representation, the output is not truncated: DEC2BIN(16;2) gives 10000. Validate the capacity separately when a hardware or file format imposes a maximum width.

Input boundaries and error cases

Negative numbers and decimal fractions such as 3.5 failed the wrapper’s digit check and returned #VALUE! in the engine tests. Numeric text “13” was accepted. An optional negative width did not add padding; a fractional width was converted to an integer. Prefer explicit valid integer inputs rather than relying on those coercions.

The following engine results show the specific inputs tested. They do not establish every text-format, locale or import rule.

Formula Engine result
=DEC2BIN(-1) #VALUE!
=DEC2BIN(3.5) #VALUE!
=DEC2BIN("13") 1101
=DEC2BIN(1;-2) 1
=DEC2BIN("abc") #VALUE!
=DEC2BIN(1;2.9) 01

Range and verification limits

The shared text-conversion helper narrows the numeric input to a C++ int before formatting it. These small integer examples do not establish safe conversion of arbitrary large identifiers. Validate the intended value and field width before export; do not assume another spreadsheet’s numeric limits or signed convention.

The Engineering module and conversion helper are byte-identical in the inspected 25.04.2 and 26.08.2 source files. That supports the source comparison, but does not turn these engine tests into execution of a newer binary or confirmation of its UI/import behavior.