Documentation/How Tos/Calc: HEX2OCT function

From Apache OpenOffice Wiki
< Documentation‎ | How Tos
Revision as of 13:30, 20 November 2009 by OOoWikiBot (Talk | contribs)

Jump to: navigation, search


Converts a hexadecimal number to octal.

This function is only available if the Analysis AddIn is installed.


HEX2OCT(hexadecimalnumber; numdigits)

returns text representing an octal number, given hexadecimalnumber, which may be text, or a number (taken to be hexadecimal although it is not).
The octal number returned may have up to ten digits in twos complement representation; positive numbers are 0 to 3777777777 octal and negative numbers 7777777777 to 4000000000 (a range of -229 to 229-1 decimal).
hexadecimalnumber must therefore also lie in this range, and is given in twos complement form with up to ten digits.
numdigits is an optional number specifying the number of digits to return.



returns 35 as text.


returns 20 as text. The number 10 is read as hexadecimal.

HEX2OCT("1D"; 3)

returns 035 as text. HEX2OCT adds a leading zero to make 3 digits.


returns 7777777776 as text (twos complement representation of decimal -2).


Personal tools