Converts a decimal number to a hexadecimal number.
Syntax
DEC2HEX(number, [places])Argumente
numbererforderlich
The decimal integer to convert, ranging from -549,755,813,888 to 549,755,813,887.
placesoptional
The number of characters to use in the output; useful for padding with leading zeros.
The DEC2HEX function takes a decimal integer and returns its hexadecimal equivalent. If the optional places argument is provided, the function pads the result with leading zeros to the specified length.
=DEC2HEX(10)→AConverts the decimal number 10 to its hexadecimal equivalent.
=DEC2HEX(10, 4)→000AConverts 10 to hexadecimal and pads it to 4 characters.
Select a cell
Click on the cell where you want to display the hexadecimal result.
Enter the formula
Type =DEC2HEX(number) and replace 'number' with your decimal value or cell reference.
Press Enter
Press the Enter key to calculate and view the hexadecimal output.
DEC2HEX uses two's complement notation for negative numbers, returning a 10-character hexadecimal string.
This occurs if the number is outside the allowed range or if the 'places' argument is too small to represent the number.