# Documentation/Calc Functions/OCT2DEC

Jump to navigation Jump to search

OCT2DEC

Add-in

## Summary:

Converts an octal number (base-8) to its decimal (base-10) equivalent. The input octal number must correspond to a decimal number d in the range -229d < 229.

OCT2DEC(Number)

## Returns:

Returns an integer number in the range -229d < 229, which is the decimal value that corresponds to the specified octal number.

## Arguments:

Number is a string or a number, or a reference to a cell containing one of those types, which gives the octal number that is to be converted to decimal. The octal number must comprise only the digits 0...7, and must be no more than 10 digits long.

• Number should use the standard two's complement representation, so that positive numbers are octal 0 to 3777777777 (0 to 229-1 decimal) and negative numbers are octal 7777777777 to 4000000000 (-1 to -229 decimal). Negative numbers must be 10 digits long with the leftmost bit set to 1; positive numbers can comprise less than 10 digits.
• If Number does not specify a valid octal number, then OCT2DEC reports an invalid argument error (Err:502). This may arise, for example, if Number contains more than 10 characters or if it contains any character other than the digits 0...7.
• If Number is a string comprising no characters, or a reference to an empty cell, OCT2DEC returns 0.
• Although the content of Number appears to be decimal, OCT2DEC will interpret it correctly.

## Additional details:

The following Wikipedia pages provide useful background information that is relevant to this function:

## Examples:

Formula Description Returns
=OCT2DEC(77) Here the function converts the octal value of 77 (passed as a number) to its decimal equivalent of 63. 63
=OCT2DEC("77") Here the function again converts the octal value of 77 (passed as a string) to its decimal equivalent of 63. 63
=OCT2DEC(D1) where cell D1 contains the number 77. Here the function again converts the octal value of 77 (passed via a cell refence) to its decimal equivalent of 63. 63
=OCT2DEC(4000000000) Here the function converts the minimum allowed 10-character octal value of 4000000000 to its decimal equivalent of -536870912 (-229). -536870912
=OCT2DEC(7777777777) Here the function converts the 10-character octal value of 7777777777 to its decimal equivalent of -1. -1
=OCT2DEC(3777777777) Here the function converts the maximum allowed 10-character octal value of 3777777777 to its decimal equivalent of 536870911 (229-1). 536870911

OCT2DEC