HEX2DEC
Converts a hexadecimal text value to decimal.
Supports up to 10 hex digits, including signed two's-complement values.
The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.
Syntax
=HEX2DEC(number)
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
number | any | Required | — |
Remarks
- Input is coerced to text and must contain only hexadecimal characters.
- 10-digit values beginning with
8-Fare interpreted as signed 40-bit numbers.
Error cases
- Returns
#NUM!for invalid characters or inputs longer than 10 digits.
Examples
Convert hexadecimal digits into a decimal number.
Formula =HEX2DEC("2A")
Expected result 42
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Read a signed ten-digit hexadecimal value.
Formula =HEX2DEC("FFFFFFFFFF")
Expected result -1
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Convert the base-sixteen representation of zero.
Formula =HEX2DEC("0")
Expected result 0
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
The character G is not a hexadecimal digit.
Formula =HEX2DEC("G")
Expected result #NUM!
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Convert a positive hex value
Formula =HEX2DEC("FF")
Expected result 255
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Related functions
FAQ
When is a 10-digit hex input treated as negative in HEX2DEC?
If the first digit is 8 through F, it is decoded as signed 40-bit two's-complement.