Related Function:

The HEX2OCT function converts a hexadecimal number into an octal number.

Syntax

=HEX2OCT(number,[places])

Note: Hexadecimal (base 16), decimal (base 10), octal (base 8), and binary (base 2) are the most commonly used numeral systems in engineering and computing. Therefore, Excel has provided functions to convert numeric values to and from each of these systems.

Arguments

Argument Description
number The hexadecimal number you want to convert

  The number cannot contain more than 10 characters
  The most significant bit of number is the sign bit
  The remaining 39 bits are magnitude bits
  Negative numbers are represented using two’s-complement notation
[places] Optional. Defines the number of characters to use

  If [places] is omitted, HEX2OCT uses the minimum number of characters necessary
  [Places] is useful for padding the return value with leading 0s (zeros)

Examples

  A B C
1 Formula Result Notes
2 =HEX2OCT(“F”,3) 017 Converts hexadecimal F to octal with 3 characters, the leading 0 is “padding”
3 =HEX2OCT(“000000000F”) 17 Converts hexadecimal F to octal
4 =HEX2OCT(“8”,10) 0000000010 Converts hexadecimal 8 to octal with 10 characters, the leading zeros are “padding”
5 =HEX2OCT(“3B4E”) 35516 Converts hexadecimal 3B4E to octal

Common Function Error(s)

Problem What went wrong
#VALUE! Occurs if the supplied [places] argument is nonnumeric
#NUM! Occurs if either:

  the supplied number argument is not recognized as a hexadecimal number
  the supplied number argument contains more than 10 characters
  the resulting octal number requires more places than is specified by the supplied [places] argument
  the supplied [places] argument ≤ 0
#NAME? Occurs when Analysis ToolPak add-in is not enabled