BIN2HEX(number, places)

Returns the number converted from binary to hexadecimal.

numberThe binary number you want to convert.
placesThe number of characters to use.

Remarks

* If "number" contains more than 10 characters (10 bits), then #NUM! is returned.
* If "number" contains 10 characters then the most significant bit (i.e. the first number) represents the sign bit (i.e. either positive or negative).
* If "number" < 0, then two's-complement notation is used to represent the number. See rows 5 and 6.
* If "number" < 0, then "places" is ignored and a 10-character hexadecimal number is returned. See rows 7 and 8.
* If "number" is not a valid binary number, then #NUM! is returned.
* If "places" is less than the number of characters needed, then #NUM! is returned.
* If "places" is left blank, the minimum number of characters necessary is used.
* If "places" is not an integer, it is truncated.
* If "places" is not numeric, then #VALUE! is returned.
* If "places" < 0, then #NUM! is returned.
* The "places" is useful for padding the return value with leading 0s.
* You can use the BIN2DEC function to convert a number from binary to decimal.
* You can use the BIN2OCT function to convert a number from binary to octal.
* You can use the HEX2BIN function to convert a number from hexadecimal to binary.
* In Excel 2007 the accuracy of this function was improved.
* In Excel 2003 this function was only available when you had the Analysis ToolPak add-in loaded.
* For the Microsoft documentation refer to support.office.com

 A
1=BIN2HEX(1,1) = 1
2=BIN2HEX(1,2) = 01
3=BIN2HEX(1,3) = 001
4=BIN2HEX(10) = 2
5=BIN2HEX(1110) = E
6=BIN2HEX(11111011,6) = 0000FB
7=BIN2HEX(11111011,4) = 00FB
8=BIN2HEX(11111011,2) = FB
9=BIN2HEX(11111011,2.6) = FB
10=BIN2HEX(111111111) = 1FF
11=BIN2HEX(1111111111) = FFFFFFFFFF
12=BIN2HEX(-10) = #NUM!
13=BIN2HEX(-10,5) = #NUM!
14=BIN2HEX(10.75) = #NUM!
15=BIN2HEX(123456789012) = #NUM!
16=BIN2HEX("some text") = #NUM!


© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited Top