BIN2OCT
Converts a binary 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
=BIN2OCT(number, [places])
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
number | number | Required | — |
places | number | Optional | — |
Return type
Can return text.
Remarks
- Input must be binary text up to 10 digits and may be signed two's-complement.
- Signed values are preserved through conversion to octal.
placesmust be at least the output width and at most10, or#NUM!is returned.
Examples
Convert a binary value using the shortest output.
Formula =BIN2OCT("1010")
Expected result 12
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?.
Ask for five output places, padding on the left.
Formula =BIN2OCT("1010",5)
Expected result 00012
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 =BIN2OCT("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 two.
Formula =BIN2OCT("102")
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 binary to octal
Formula =BIN2OCT("111111")
Expected result 77
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?.
Pad octal output
Formula =BIN2OCT("111111",4)
Expected result 0077
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 are signed 10-bit binaries handled by BIN2OCT?
They are first decoded as signed decimal and then re-encoded to octal with two's-complement output for negatives.