Converts a hexadecimal number to octal.
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.
HEX2OCT("1D")
returns 35 as text.
HEX2OCT(10)
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.
HEX2OCT("FFFFFFFFFE")
returns 7777777776 as text (twos complement representation of decimal -2).
Configuring a Network Router
Imagine you are a network administrator and need to configure a legacy router using its command-line interface (CLI). This particular router's CLI uses octal numbers for some configuration parameters, but the documentation you have for a specific network setting provides the value in hexadecimal.
Let's say you need to set the value for a "Quality of Service (QoS) Priority" field. The documentation specifies a hexadecimal value of A2. However, the router's CLI expects an octal input. You need to convert A2 from hexadecimal to octal.
Here is how the HEX2OCT function would be used in this scenario:
The hexadecimal number is A2.
So, the octal value you would enter into the router's CLI is 242.
The function would look like this:
HEX2OCT("A2")
This function would return the value 242.
Table:
Hexadecimal Value | Binary Conversion | Grouped Binary | Octal Conversion | ||
|---|---|---|---|---|---|
A | B | C | D | ||
1 | A2 | 1010 0010 | 010 100 010 | 242 |
The HEX2OCT function automates this entire process, ensuring a quick and error-free conversion, which is crucial when dealing with critical network configurations.
PRODUCT & FEATURES
RESOURCES
Terms | Privacy | Spam Policy
© 2026 Zapof