Syntax
| Parameter | Description |
|---|---|
| number | Parameter of the DEC2HEX function. |
| [places] | (Optional.) Parameter of the DEC2HEX function. |
Examples
Convert to hex
=DEC2HEX(255)
Color code construction
=DEC2HEX(200, 2)&DEC2HEX(100, 2)&DEC2HEX(50, 2)
With leading zeros
=DEC2HEX(16, 4)
Common Errors
The number is outside the valid range (-549,755,813,888 to 549,755,813,887), or places is too small.
The argument is non-numeric or places is invalid.
Tips
Build CSS hex colors: ="#"&DEC2HEX(R,2)&DEC2HEX(G,2)&DEC2HEX(B,2) converts RGB values to a web color like #FF6633.
DEC2HEX returns uppercase letters (A-F). If you need lowercase, wrap in LOWER(): =LOWER(DEC2HEX(255)) returns 'ff'.
The output is up to 10 hex characters. For numbers larger than the supported range, you'll need a custom solution.
Try DEC2HEX in Viztab
Import your data and use DEC2HEX with 370+ other formulas. No signup required.
Open Viztab