# DEC2HEX

Formulas / DEC2HEX
Convert decimal numbers to hexadecimal numbers.
`=DEC2HEX(number, [places])`
• number - required, decimal integer to convert
• places - [OPTIONAL] number of characters to use

## Examples

• `DEC2HEX(100, 4)`

The function converts the decimal value 100 to its hexadecimal equivalent, padded with two leading zeros. The hexadecimal value for 100 is 64, but DEC2HEX adds two leading zeros to the result, making it 0064.

• `DEC2HEX(-54)`

The function is used to convert the decimal value -54 to its hexadecimal equivalent. The hexadecimal value for -54 is -36.

• `DEC2HEX(28)`

The function is used to convert the decimal value 28 to its hexadecimal equivalent. The hexadecimal value for 28 is 1C.

• `DEC2HEX(64,1)`

The function is used to convert the decimal value 64 to its hexadecimal equivalent, padded with one leading zero. However, the hexadecimal value for 64 is 40, which requires two digit places. Therefore, the function returns an error value.

## Summary

The DEC2HEX function converts a decimal number to its corresponding hexadecimal notation. This conversion can be done with or without specifying the places argument.

• The DEC2HEX function is used to convert a decimal number into hexadecimal notation.
• The result of the DEC2HEX function is a string representing the hexadecimal notation of the decimal number.

What is the DEC2HEX function?
The DEC2HEX function is used to convert a decimal number to hexadecimal format.
What is the syntax of the DEC2HEX function?
The syntax of the DEC2HEX function is DEC2HEX(number,places). The places argument is optional.
What arguments does the DEC2HEX function take?
The DEC2HEX function takes two arguments:
• Number: This is the decimal integer to convert.
• Places: This is an optional argument that specifies the number of places characters to return.
What errors can the DEC2HEX function return?
The DEC2HEX function can return two errors:
• #VALUE!: If the number argument is not numeric.
• #NUM!: If DEC2HEX needs more than the number of places characters specified. 