DEC2HEX Function in Google Sheets

Convert a decimal number to a hexadecimal number using the DEC2HEX function.

DEC2HEX Function

The DEC2HEX function in Google Sheets is used to convert a decimal number to its hexadecimal equivalent.

Syntax

DEC2HEX(decimal_number, [significant_digits])
  • decimal_number: The decimal number you want to convert. This is a required parameter.
  • significant_digits: (Optional) The number of digits you want the hexadecimal number to contain.

Examples

  1. Basic Conversion

Convert the decimal number 255 to hexadecimal:

=DEC2HEX(255)

This will output FF.

  1. Conversion with Significant Digits

Convert the decimal number 15 to hexadecimal with 4 significant digits:

=DEC2HEX(15, 4)

This will output 000F.

Notes

  • The function can handle decimal numbers from -549,755,813,888 to 549,755,813,887.
  • If significant_digits is provided, the hexadecimal result will be padded with leading zeros to match the specified length.
  • DEC2BIN: Convert a decimal number to a binary number.
  • DEC2OCT: Convert a decimal number to an octal number.