HEX2OCT
Converts a hexadecimal text value to octal text.
Supports optional left-padding through the places argument.
The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.
Syntax
=HEX2OCT(number, [places])
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
number | any | Required | — |
places | any | Optional | — |
Return type
Can return text.
Remarks
- Input must be hexadecimal text up to 10 characters and may be signed two's-complement.
- Converted values must fit the octal range
[-2^29, 2^29 - 1], or#NUM!is returned. placesmust be at least the output width and at most10, or#NUM!is returned.
Examples
Convert hexadecimal 1E with no output padding.
Formula =HEX2OCT("1E")
Expected result 36
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Use eight output characters to preserve leading zeros.
Formula =HEX2OCT("1E",8)
Expected result 00000036
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Convert zero with a one-place width.
Formula =HEX2OCT("0",1)
Expected result 0
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
The input contains an invalid hexadecimal digit.
Formula =HEX2OCT("G")
Expected result #NUM!
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Convert hex to octal
Formula =HEX2OCT("1F")
Expected result 37
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Convert signed hex
Formula =HEX2OCT("FFFFFFFFFF")
Expected result 7777777777
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Related functions
FAQ
What causes HEX2OCT to return #NUM!?
The decoded value must fit octal output range [-2^29, 2^29 - 1], and optional places must be valid.