DEC2HEX Function (Calligra Sheets)
Convert decimal integers to uppercase hexadecimal in Calligra, with padded identifiers, positional checks and exact input-validation examples.
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: =DEC2HEX(461;4) gives 01CD in the tested Calligra calculation engine. Successful DEC2HEX 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
DEC2HEX returns hexadecimal text using digits 0–9 and uppercase A–F. For example, 461=1×256+12×16+13, so the natural representation is 1CD. Leading zeroes affect a code’s presentation but not its decoded value. Function help.
Syntax and arguments
=DEC2HEX(number[;places])
Number is required; places is optional minimum length. The registration allows one or two arguments even though the compact help syntax shows only the first. Use nonnegative integers. Decimal digit text is accepted by the tested implementation; signs and fractional decimal points fail the wrapper’s full-string digit check. 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 |
|---|---|
=DEC2HEX(0) |
0 |
=DEC2HEX(10) |
A |
=DEC2HEX(15) |
F |
=DEC2HEX(16) |
10 |
=DEC2HEX(255;4) |
00FF |
=DEC2HEX(461;4) |
01CD |
=DEC2HEX(4095;2) |
FFF |
=DEC2HEX(65535) |
FFFF |
Practical worksheet
Enter decimal ID 461 in A2 and width 4 in B2. =DEC2HEX(A2;B2) yields 01CD. Keep the result as text if it is exported to an identifier column. The prefix zero is part of the string and is not a number-format decoration on the original decimal value.
Advanced checks and field widths
The recorded =HEX2DEC(DEC2HEX(461;4)) returns numeric 461. This is an appropriate check for a table of small validated integer IDs. A width of four can express nonnegative values through 65535; the table shows that endpoint as FFFF. Larger values require a larger field, regardless of whether the function can produce more characters.
A short width does not cut off significant digits. DEC2HEX(4095;2) returns FFF, not FF. Check LEN of an output against an external fixed-width specification rather than trimming the string to force it to fit.
Input boundaries and error cases
The engine rejected −1 and 15.9 with #VALUE!, but accepted the numeric text “255”. The tested negative width added no padding, and a width of 2.9 produced two characters. Some help examples use lowercase letters; the current shared helper explicitly converts the result to uppercase, matching the recorded outputs.
The following engine results show the specific inputs tested. They do not establish every text-format, locale or import rule.
| Formula | Engine result |
|---|---|
=DEC2HEX(-1) |
#VALUE! |
=DEC2HEX(15.9) |
#VALUE! |
=DEC2HEX("255") |
FF |
=DEC2HEX(15;-1) |
F |
=DEC2HEX("abc") |
#VALUE! |
=DEC2HEX(15;2.9) |
0F |
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.