The BIN2HEX function

Share on facebook
Share on twitter
Share on linkedin
Share on telegram
Share on whatsapp


Welcome back to our usual blog of Excel functions from A to Z. Today we look at the BIN2HEX function.

The BIN2HEX function

We don't want to put the hexadecimal in this function, but this converts a binary number (base two) in a hexadecimal number (base 16).

The BIN2HEX The function uses the following syntax to operate:

BIN2HEX (number, [places])

The BIN2HEX 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, BIN2HEX 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 then 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), BIN2HEX return the #ON ONE! error value
  • And number is negative, BIN2HEX ignore places and returns a hexadecimal number of 10 characters
  • And BIN2HEX 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, BIN2HEX return the #VALUE! error value
  • And places is negative, BIN2HEX return the #ON ONE! error value

Please, see my example below:

Subscribe to our Newsletter

We will not send you SPAM mail. We hate it as much as you.