Welcome back to our usual blog of Excel functions from A to Z. Today we look at the BIN2OCT function.
The BIN2OCT function
This function converts a binary number (base two) in an octal number (base eight).
The BIN2OCT The function uses the following syntax to operate:
BIN2OCT (number, [places])
The BIN2OCT The function has the following arguments:
- number: this is required and represents the binary number you want to convert. it should be noted that number cannot contain more than 10 characters (10 bits) and that the most significant bit of number is the sign bit. The remaining nine bits are bits of magnitude. Negative numbers are represented by two's complement notation
- places: this is optional and represents the number of characters to use. And places is omitted, BIN2OCT use the minimum number of characters necessary. The argument places it is useful for padding the return value with leading zeros.
Two's complement is a mathematical operation on binary numbers, as well as a representation of signed binary numbers based on this procedure. The two's complement of a North-number of bits is set as the complement with respect to 2North; In other words, is the result of subtracting the number of 2North. This is also equivalent to taking the complement of ones and later adding one, since the sum of a number and the complement of its ones is 1 bits. The two's complement of a number behaves like the negative of the original number in most arithmetic operations, and positive and negative numbers can coexist naturally.
It should be noted at the same time that:
- And number is not a valid binary number, o si number contains more than 10 characters (10 bits), BIN2OCT return the #ON ONE! error value
- And number is negative, BIN2OCT ignore places and returns an octal number of 10 characters
- And BIN2OCT need more than places characters, return the #ON ONE! error value
- And places it is not a whole number, is truncated
- And places it is not numeric, BIN2OCT return the #VALUE! error value
- And places is negative, BIN2OCT return the #ON ONE! error value
Please, see my example below: