The DEC2HEX function in excel is used to convert a decimal number to hexadecimal.

**What is DEC2HEX function in Excel?**

The DEC2HEX function is a built-in function in excel which comes under Engineering category. As its name implies, it is used for converting a decimal number to hexadecimal.

**How the DEC2HEX function is used in Excel?**

In an excel worksheet, the DEC2HEX function is easy to use. For instance, to convert decimal number 10 to hexadecimal, apply the formula simply.

**Formula or Syntax**

`=DEC2HEX(number,places)`

**Parameters or Arguments of a DEC2HEX function**

The arguments in the DEC2HEX function are:

- Number: Required: It is the decimal integer that you want to convert into hexadecimal. If the entered decimal integer is negative then the function returns a 10-character hexadecimal number. In that return value, the sign bit is considered the most significant bit and remaining bits are magnitude bits.
- Places: Optional: It signifies a number of characters in return value.

**Example**

An example of the DEC2HEX function is given below. Follow the steps to learn the working of the function:

- Let’s take an example. Take a decimal number 16 and apply the DEC2HEX function on the B3 cell as shown below.

* Figure 1. Take a decimal number*

- Now, enter the number as 16 that you want to convert and enter the input for places. Here, we have taken the 5 and now if the return value is less than 5 characters then the function will add zero to the left of the number.

*Figure 2. Enter arguments for the DEC2HEX function*

- Finally, you will get the results displayed on the B3 cell as shown in the figure. Similarly, you can convert any decimal number to hexadecimal.

*Figure 3. The function returns hexadecimal value*

**Note on Usage of DEC2HEX function**

The notes on usage are listed below:

- The DEC2HEX function returns error value #VALUE! If number is <-549,755,813,888 or number is > 549,755,813,888.
- The function returns error value #VALUE! If entered number or places is non-numeric.
- The function returns error value #NUM! If it needs more than places characters or places is –ve.
- The function is truncated if the input value for places is non-integer.

## Leave a Comment