Calc DEC2HEX function

The DEC2HEX function converts a decimal number to its hexadecimal equivalent.

Help CentreFunctions & Formulas

For a full list of available calculation functions, please read What calculation functions are supported.


Description

The DEC2HEX function converts a decimal number to its hexadecimal equivalent. This is useful in various applications, especially in computing and digital electronics, where hexadecimal representation is commonly used.


Syntax

DEC2HEX(number, [places])


The DEC2HEX function syntax has the following arguments:

  • number Required. The decimal number you want to convert to hexadecimal. It must be an integer between -549755813888 and 549755813887.
  • places Optional. The number of characters to use for the hexadecimal result. If omitted, the function returns the minimum number of characters necessary to represent the number in hexadecimal.

Example

FormulaDescriptionResult
=DEC2HEX(255)Converts the decimal number 255 to hexadecimal.FF
=DEC2HEX(4095)Converts the decimal number 4095 to hexadecimal.FFF
=DEC2HEX(-1)Converts the decimal number -1 to hexadecimal (two's complement representation).FFFFFFFF
=DEC2HEX(255, 4)Converts the decimal number 255 to hexadecimal with at least 4 characters.00FF

Errors

For a full list of formula errors, please read Formula errors.


Related functions

See it working on your own data

Everything documented here ships with the platform – try the document tools free, or go live in 7 days.