The HEX2DEC function in Google Sheets converts a signed hexadecimal number to its decimal equivalent.
Contents
Syntax
The syntax for the HEX2DEC function is:
=HEX2DEC(hexadecimal_number)
hexadecimal_number
– The hexadecimal number for the function to convert.- You can enter the hexadecimal number as a text string or number. For example, the following formulas are equivalent.
=HEX2DEC("199")
is the same as=HEX2DEC(199)
.
- You can enter the hexadecimal number as a text string or number. For example, the following formulas are equivalent.
HEX2DEC Examples
Spreadsheet users can employ the HEX2DEC function to convert hexadecimal numbers to decimal numbers for various purposes. For example, you can use the HEX2DEC function to convert hexadecimal color codes to decimal values.
Example 1 – Converting Color Codes
First, see how the following formula converts the hexadecimal color code #FF0000
to the decimal value 16711680.
=HEX2DEC("FF0000")
Example 2 – Converting Memory Addresses
Next, we’ll look at how to use the HEX2DEC function to convert hexadecimal memory addresses to decimal values. The following formula converts the hexadecimal memory address 0x12345678 to the decimal value 305419896:
=HEX2DEC("0x12345678")
Example 3 – Converting Unicode
Now let’s convert the Unicode for an emoji from signed hexadecimal to decimal. The signed hexadecimal code for a grinning face emoji 😀 is 1F600. You need to convert the number to decimal to use it with the CHAR function.
=CHAR(HEX2DEC("1F600"))
Live Example in Google Sheets
You can make a copy of this spreadsheet to see these examples and use them in your work.