OCT2HEX
Converts an octal text value to hexadecimal 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
=OCT2HEX(number, [places])
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
number | number | Required | — |
places | number | Optional | — |
Return type
Can return text.
Remarks
- Input must be octal text up to 10 digits and may be signed two's-complement.
- Signed values are converted through their decimal representation.
placesmust be at least the output width and at most10, or#NUM!is returned.
Examples
Convert octal 36 with no output padding.
Formula =OCT2HEX("36")
Expected result 1E
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 =OCT2HEX("36",8)
Expected result 0000001E
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 =OCT2HEX("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 a digit outside base eight.
Formula =OCT2HEX("8")
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 octal to hex
Formula =OCT2HEX("77")
Expected result 3F
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 octal
Formula =OCT2HEX("7777777777")
Expected result FFFFFFFFFF
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
How does OCT2HEX treat signed octal input?
Signed 10-digit octal is decoded via two's-complement and then emitted as hex, preserving signed meaning.