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
- Basic Conversion
Convert the decimal number 255
to hexadecimal:
=DEC2HEX(255)
This will output FF
.
- 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
to549,755,813,887
. - If
significant_digits
is provided, the hexadecimal result will be padded with leading zeros to match the specified length.