DEC2OCT
Converts a decimal integer to octal text.
Optionally pads the result with leading zeros using places.
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
=DEC2OCT(number, [places])
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
number | number | Required | — |
places | number | Optional | — |
Return type
Can return text.
Remarks
numberis coerced to an integer and must be in[-2^29, 2^29 - 1].- Negative values are returned as 10-digit two's-complement octal strings.
placesmust be at least the output width and at most10, or#NUM!is returned.
Examples
Convert a decimal integer using the shortest output.
Formula =DEC2OCT(30)
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?.
Request eight characters to see the leading-zero padding.
Formula =DEC2OCT(30,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 a negative value to its signed representation.
Formula =DEC2OCT(-1)
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?.
A nonzero value cannot fit in a zero-place output.
Formula =DEC2OCT(30,0)
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 decimal to octal
Formula =DEC2OCT(64)
Expected result 100
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 range does DEC2OCT support?
number must be in [-2^29, 2^29 - 1]; outside that range returns #NUM!.