Calc OCT2HEX function

Converts an octal number to hexadecimal.

Help CentreFunctions & Formulas

For a full list of available calculation functions, please read What calculation functions are supported.

This article describes the formula syntax and usage of the OCT2HEX function.


Description

Converts an octal number to hexadecimal.


Syntax

OCT2HEX(number, [places])


The OCT2HEX function syntax has the following arguments:
  • number - Required. The octal number you want to convert. The number cannot contain more than 10 characters (the most significant bit is the sign bit).
  • places - Optional. The number of characters to use. If places is omitted, the minimum number of characters necessary to represent the hexadecimal number is used. If places is specified and is greater than the length of the converted hexadecimal number, the result is padded with leading zeros. If places is specified and is less than the length of the converted hexadecimal number, the #NUM! error value is returned.

Remarks

  • Number is interpreted as a signed number in octal notation. Valid numbers are from 0 to 7777777777 (octal), which is equivalent to 0 to 536870911 (decimal) for positive numbers, and from -1 to -2000000000 (octal), which is equivalent to -1 to -536870912 (decimal) for negative numbers.
  • If number is not a valid octal number, OCT2HEX returns the #NUM! error value.
  • If number is negative, OCT2HEX uses two's-complement notation to represent the hexadecimal number.

Example

FormulaDescriptionResult
=OCT2HEX(17)Converts octal 17 to hexadecimal.F
=OCT2HEX(17, 4)Converts octal 17 to hexadecimal, using 4 characters.000F
=OCT2HEX(-17)Converts negative octal 17 to hexadecimal.FFFFFFFFF
=OCT2HEX(-17, 4)Converts negative octal 17 to hexadecimal, using 4 characters.FFFF

Errors

For a full list of formula errors, please read Formula errors.


Related functions

See it working on your own data

Everything documented here ships with the platform – try the document tools free, or go live in 7 days.