[Table of Contents] [docx version]

SpreadsheetML Reference Material - Table of Contents

HEX2OCT

Syntax:

HEX2OCT ( number [ , num-oct-digits ] )

Description: Makes the octal equivalent of number, with the result having num-oct-digits digits.

Arguments:

Name

Type

Description

number

text

A 10-digit hexadecimal number in a string that is to be converted to an octal string. number is not case-sensitive. 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 (40th bit from the right) representing the sign bit.

num-oct-digits

number

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

 

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

However, if

number is outside the range "FFE0000000" (17774000000000 octal, -536,870,912 decimal) to "1FFFFFFF" (00003777777777 octal, 536,870,911 decimal), inclusive, #NUM! is returned.

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

number contains more than 10 hexadecimal digits, #NUM! is returned.

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

num-oct-digits is negative or > 10, #NUM! is returned.

[Example:

HEX2OCT("fE") results in 376
HEX2OCT("FFFFFFFFFE") results in 7777777776
HEX2OCT("2") results in 2
HEX2OCT("F",6) results in 000017

end example]