Contact

HEX2DEC Function (OpenOffice Calc)

Engineering Intermediate OpenOffice Calc

Learn the HEX2DEC function in Apache OpenOffice Calc: Converts a hexadecimal number to a decimal number.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

Availability and version history

  • Introduced: Documented by Apache OpenOffice 4.1.16; original introduction not established.
  • Availability: Supported in Apache OpenOffice 4.1.16, verified against its function registry. This identifies a supported release, not a final working version.
  • Scope: Desktop Calc, using the English function name. Availability in other spreadsheet applications is separate.
  • Checked: 2026-10-14 — function reference; versioned support. Documentation/source check; not a new native test. Existing example-specific test claims below retain their stated scope.

HEX2DEC converts hexadecimal digit text into a decimal number. It accepts at most ten characters and applies a forty-bit signed convention only when the input has exactly ten digits and its first digit is 8 through F. Shorter strings remain nonnegative. Uppercase and lowercase hexadecimal letters are recognized.

Syntax and arguments

=HEX2DEC(hexadecimal_text)

Supply one text string containing digits 0–9 and letters A–F, or their lowercase equivalents. Do not include a 0x prefix, minus sign, spaces or decimal point. There is no optional width or signedness parameter. The helper accepts an empty string as zero and checks character length before parsing, so eleven leading zeros are still too long. The examples use English names and semicolon separators.

Reproducible reference cases

Formula Reference result
=HEX2DEC("FF") 255
=HEX2DEC("ff") 255
=HEX2DEC("000A") 10
=HEX2DEC("FFFFFFFF") 4294967295
=HEX2DEC("7FFFFFFFFF") 549755813887
=HEX2DEC("8000000000") -549755813888
=HEX2DEC("FFFFFFFFFF") -1
=HEX2DEC("FFFFFFFFFE") -2
=HEX2DEC("") 0
=HEX2DEC("0xFF") ERROR
=HEX2DEC("G") ERROR
=HEX2DEC("00000000000") ERROR

The first formula preserves the original example and expected result. Its historical comparable LibreOffice 25.2 check was not an OpenOffice native test. New results are independently checked mathematical/source expectations. Quotation marks identify returned text; ERROR denotes the source’s invalid-argument path without claiming an observed localized worksheet message.

Practical worksheet: decode hexadecimal byte labels

Enter text labels 00,0A,0F,10,FF in A2:A6. In B2 enter =HEX2DEC(A2) and fill down. The numerical results are 0,10,15,16 and 255. In C2 enter =DEC2HEX(B2;2) and fill down; the canonical two-character uppercase labels are recovered.

The labels are one-byte values in this example, so require exactly two hexadecimal digits and an agreed unsigned meaning before using them as byte data. HEX2DEC itself also accepts much longer words and does not enforce that external field width. Keep the source text for checking and preserve any record identifiers separately.

Advanced interpretation and checks

Check the sign threshold. 7FFFFFFFFF is the largest positive forty-bit signed value, 549755813887. 8000000000 is the smallest, -549755813888. FFFFFFFFFF first parses to the unsigned value 1099511627775; subtracting 1099511627776 yields -1. The width-sensitive sign rule explains the sudden sign change.

Do not infer a thirty-two-bit sign. FFFFFFFF has eight digits and returns 4294967295, not -1. For a separately specified signed thirty-two-bit protocol, an unsigned value at least 2147483648 would need subtraction of 4294967296. That external interpretation is not selected automatically by HEX2DEC.

Normalize spelling without losing the raw field. HEX2DEC(“ff”) and HEX2DEC(“00FF”) both yield 255. DEC2HEX of the result produces FF by default, or 00FF with places=4. A numerical round trip preserves the value, while the exact spelling and original width require retaining the original string.

Errors, limits and troubleshooting

Invalid letters, prefixes, signs, whitespace and excessive length follow the illegal-argument path. The source does not silently strip these characters. Use a deliberate normalization step only if the input format permits it; blindly deleting characters can hide a corrupt field. These errors are source-derived expectations, with no fresh native error-message test.

An empty string is converted to zero. If that should mean unknown or missing in the dataset, test for absence separately instead of allowing a missing reading to become a valid numeric zero. Literal empty text and arbitrary blank-looking worksheet values are not asserted to have identical coercion paths.

All valid signed forty-bit integer values fit within the exact-integer range of ordinary binary64 arithmetic, but the original text width is still lost in the output. Number formatting cannot restore whether the source was FF, 00FF or lowercase ff. Avoid importing a hexadecimal label as an ordinary decimal number, especially when it contains only numeric digits. Locale-dependent coercion, unusual embedded control characters, arrays and save/reload behavior remain unverified.

Documentation and verification

See the Apache OpenOffice HEX2DEC reference, 4.1.16 Analysis callbacks and signed bounds, signed text decoder, decimal encoder, and optional width conversion. Official source snapshots were retrieved October 13, 2026 and re-read for this guide; no fresh retrieval or native execution is implied. Original introduction and final functioning version remain unestablished, separate from the pinned 4.1.16 support. No screenshots, native workbooks or cross-product compatibility claims were created for these controls.