Features of !SEMTools

DEC2HEX

DEC2HEX function in Excel - decimal to hexadecimal conversion examples
Examples of using the DEC2HEX function
Function categoryEngineering functions
VolatilityNon-volatile
Similar functionsBIN2DEC, DEC2BIN, HEX2DEC

What does this function do?

This function converts a decimal number to its hexadecimal equivalent.

It can only accept numbers from -549,755,813,888 to 549,755,813,887.

The result can be padded with leading zeros using an optional parameter, which is ignored for negative numbers.

Syntax

=DEC2HEX(decimal_number, [places])
  • decimal_number — required. The decimal integer you want to convert
  • places — optional. The number of characters to use. If omitted, uses the minimum number necessary

Usage examples

Convert decimal 255 to hexadecimal:

=DEC2HEX(255)

Result: “FF”

Convert decimal 16 to hexadecimal with 4 characters:

=DEC2HEX(16, 4)

Result: “0010”

Convert negative decimal number:

=DEC2HEX(-100)

Result: “FFFFFFFFFFFFFF9C”

Features

  • Negative numbers are represented using two’s complement notation
  • The places parameter is ignored for negative numbers
  • If places is too small, returns the #NUM! error
  • If decimal_number is less than -549,755,813,888 or greater than 549,755,813,887, returns the #NUM! error
  • If decimal_number is nonnumeric, returns the #VALUE! error
  • If places is nonnumeric, returns the #VALUE! error
  • If places is not an integer, it is truncated

Other Engineering functions in Excel

BIN2DEC, DELTA, DEC2BIN, GESTEP, CONVERT, HEX2DEC, DEC2OCT, OCT2DEC, BIN2HEX, HEX2BIN

Like the article? Help its author! Buy !SEMTools, it has lots of useful instruments to process text data.

This post is also available in RU.