[Table of Contents] [docx version]

SpreadsheetML Reference Material - Table of Contents

OCT2BIN

Syntax:

OCT2BIN ( number [ , num-bin-digits ] )

Description: Makes the binary equivalent of number, with the result having num-bin-digits digits.

Arguments:

Name

Type

Description

number

text

A 10-digit octal number in a string that is to be converted to a binary 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-bin -digits

number

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

 

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

However, if

number is outside the range "7777777000" (111111111111111111111000000000 binary, -512 decimal) to "777" (000000000000000000000111111111 binary, 511 decimal), inclusive, #NUM! is returned.

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

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

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

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

[Example:

OCT2BIN("67") results in 110111
OCT2BIN("7777777776") results in 1111111110
OCT2BIN("7",5) results in 00111

end example]