Contact

HEX2OCT Function (OpenOffice Calc)

Engineering Intermediate OpenOffice Calc

Translate hexadecimal text to octal in Apache OpenOffice, with forty-bit source decoding, thirty-bit output limits and exact padding examples.

Verification status: Eight reference formulas and 7 diagnostic cases were recalculated in Apache OpenOffice 4.1.16 on Linux x86-64, Build 9816, using XLSX import and GUI hard recalculation. Saved formula identities and typed results were checked. How formula examples are checked

Quick answer: =HEX2OCT("FF") returned 377 in the tested Apache OpenOffice 4.1.16 build.

Availability and version history

  • Introduced: First release not established; documented by OpenOffice.org 3.3.
  • Supported in: Apache OpenOffice 4.1.16; this identifies a verified release, not a final supported version.
  • Scope: Desktop Calc with its Analysis add-in, English function names and semicolon-separated formulas.
  • Checked: October 14, 2026. Eight reference formulas and the listed diagnostics were recalculated after XLSX import in 4.1.16 on Linux x86-64, Build 9816. Source and independent reference calculations were also checked.

What HEX2OCT returns

HEX2OCT decodes hexadecimal text and encodes the result as octal text. Its ten-hex-digit input convention is signed forty-bit, while its ten-octal-digit output convention is signed thirty-bit. The output range is consequently narrower. Release entry.

Syntax and arguments

=HEX2OCT(HexNumber [; Places])

Supply at most ten hexadecimal digits, case-insensitive, without whitespace, a sign or a 0x prefix. Exactly ten digits starting with 8–F represent negative values. The decoded integer must be from −536870912 to 536870911. Optional Places pads nonnegative outputs and must convert to 1 through 10.

Reproducible examples

The native column records the saved 4.1.16 results. Text-returning conversion strings are retained exactly, including leading zeroes and uppercase hexadecimal letters. OCT2DEC, IMREAL and IMAGINARY return numeric values. These integer and quarter-unit references agree exactly with the saved results; errors are checked by display rather than interpreted from a numeric zero cache.

Formula Native 4.1.16 result Independent reference
=HEX2OCT("0") 0 0
=HEX2OCT("1") 1 1
=HEX2OCT("A") 12 12
=HEX2OCT("FF") 377 377
=HEX2OCT("1FFFFFFF") 3777777777 3777777777
=HEX2OCT("FFFFFFFFFF") 7777777777 7777777777
=HEX2OCT("FFE0000000") 4000000000 4000000000
=HEX2OCT("2A") 52 52

Practical worksheet

=HEX2OCT("2A") returns 52. For a four-character positive field, =HEX2OCT("A";4) returns 0012. The value is decimal 10 in both representations.

The largest positive allowed value is hexadecimal 1FFFFFFF, which becomes 3777777777. The next integer, 20000000, cannot fit the signed thirty-bit octal output and is rejected. A valid hexadecimal string is not automatically a valid HEX2OCT argument.

Advanced interpretation and checks

The ten-digit hex code FFFFFFFFFF decodes to −1, producing ten octal sevens. The code FFE0000000 decodes to −536870912, producing 4000000000, the most negative signed thirty-bit octal code.

Positive conversion can be checked by going through binary groups: four bits per hex digit and three per octal digit. For negative values, decode the source sign width first rather than merely regrouping every original bit.

The test using too-small Places verifies rejection instead of digit truncation. Returned leading zeroes are text padding; they do not increase the representable numeric range.

Boundaries and troubleshooting

Inputs just above the positive limit and just below the negative limit are rejected in the diagnostics. Lowercase hex is accepted, but the conventional programming prefix 0x is not. Empty input decodes as zero. Preserve that distinction when validating imported code fields or missing data.

These additional formulas were recalculated through the same import path. Error displays are retained as errors, even when an ODS numeric attribute stores zero.

Formula Observed result or error
=HEX2OCT("A";4) 0012
=HEX2OCT("1FFFFFFF";9) Err:502
=HEX2OCT("20000000") Err:502
=HEX2OCT("FFDFFFFFFF") Err:502
=HEX2OCT("ff") 377
=HEX2OCT("") 0
=HEX2OCT("0xA") Err:502

Other spreadsheet implementations

The HEX2OCT guide for Gnumeric documents that product’s own syntax and tested behavior. A shared function name does not guarantee the same argument conversion, text parsing, branch or precision rules.

Official evidence and checking scope

The saved ODS retained every tested formula identity. A deliberately stale SUM cache changed from 999999 to 3, and an uncached SUM returned 7 after hard recalculation. Native evidence covers the eight reference formulas and listed diagnostics only. Other explanatory compositions are independent mathematical checks; other releases, locales and extreme-value behavior were not established by this run.