[Table of Contents] [docx version]

SpreadsheetML Reference Material - Table of Contents

OCT2HEX

Syntax:

OCT2HEX ( number [ , num-hex-digits ] )

Description: Makes the hexadecimal equivalent of number, with the result having num-hex-digits digits.

Arguments:

Name

Type

Description

number

text

A 10-digit octal number in a string that is to be converted to a hexadecimal string. If number has less than 10 digits, leading zero digits are implied until it has exactly 10 digits. The 10 digits use twos-complement representation with the left-most bit (30th bit from the right) representing the sign bit.

num-hex-digits

number

num-hex-digits is the number of digits in the result, with leading zeros added as necessary. However, if number is negative, num-hex-digits is ignored and the result has 10 digits. If num-hex-digits is omitted, the minimum number of digits is used in the result. num-hex-digits is truncated to an integer.

 

Return Type and Value: text – The hexadecimal equivalent of number.

However, if

number contains one or more non-octal digits, #NUM! is returned.

number contains more than 10 octal digits; that is, number is outside the range "4000000000" (20000000 hex, -536,870,912 decimal) to "3777777777" (1FFFFFFF hex, 536,870,911 decimal), inclusive, #NUM! is returned.

number needs more digits that num-hex-digits, #NUM! is returned.

num-hex-digits ≤ 0or > 10, #NUM! is returned.

[Example:

OCT2HEX("777") results in 1FF
OCT2HEX("7777777776") results in FFFFFFFFFE
OCT2HEX("7",5) results in 00007

end example]