OCT2HEX Function (Calligra Sheets)
Translate octal digits into uppercase hexadecimal with Calligra OCT2HEX, including output padding, round-trip checks and strict text inputs.
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: =OCT2HEX("715";4) gives 01CD in the tested Calligra calculation engine. Successful OCT2HEX 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
OCT2HEX reads a base-8 representation and returns hexadecimal text for the same nonnegative value. For example, octal 715 means 7×64+1×8+5=461, which is hexadecimal 1CD. The input and output use different digit alphabets and place weights. Function help.
Syntax and arguments
=OCT2HEX(octal[;places])
Octal is required and places is optional minimum hexadecimal length. Input must be an uninterrupted sequence of digits 0 through 7. This wrapper is stricter than OCT2DEC’s shared parser: a leading sign or surrounding spaces are rejected before conversion. 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 |
|---|---|
=OCT2HEX("0") |
0 |
=OCT2HEX("12") |
A |
=OCT2HEX("17") |
F |
=OCT2HEX("20") |
10 |
=OCT2HEX("377";4) |
00FF |
=OCT2HEX("715";4) |
01CD |
=OCT2HEX("1000") |
200 |
=OCT2HEX("777";1) |
1FF |
Practical worksheet
For the octal text 715 in A2 and width 4 in B2, =OCT2HEX(A2;B2) gives 01CD. Keep the input as text during import so an application does not reinterpret it as decimal seven hundred fifteen. The output is also text, with leading zeroes included in the value.
Advanced checks and field widths
The recorded =HEX2OCT(OCT2HEX("715");4) returns 0715. The numeric value is unchanged, while the requested final width adds one leading octal zero. This illustrates why a value round trip does not automatically restore an original field’s formatting.
Octal 377 gives hexadecimal FF because 3×64+7×8+7=255. Octal 1000 instead gives hexadecimal 200, representing 512. A short output width does not discard digits: OCT2HEX("777";1) gives 1FF, not only its last hexadecimal character.
Input boundaries and error cases
Digit 8, a minus sign and surrounding spaces all produced #VALUE! in the engine tests. A width of zero or a negative width left the natural output, while width 3.9 yielded three characters. The current helper uppercases hexadecimal letters; older help examples using lowercase do not describe the case of these recorded results.
The following engine results show the specific inputs tested. They do not establish every text-format, locale or import rule.
| Formula | Engine result |
|---|---|
=OCT2HEX("8") |
#VALUE! |
=OCT2HEX("-1") |
#VALUE! |
=OCT2HEX(" 17 ") |
#VALUE! |
=OCT2HEX("17";0) |
F |
=OCT2HEX("17";-1) |
F |
=OCT2HEX("17";3.9) |
00F |
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.