
📎 This article includes 1 downloadable practice file ↓
In this article
HEX2DEC reads hex text — colour codes, error codes from logs — as a number.
Syntax
=HEX2DEC(number)
| Argument | What it means |
|---|---|
number |
Up to 10 hex characters. |
Examples
Example 1
=HEX2DEC(MID(A2,2,2))
Red channel from a colour like #FF8000 (255).
HEX2DEC in practice
Where you will use it
- Read colour codes as numbers
- Decode hex IDs from logs
- Convert meter readings
Worked example
| Hex | Formula | Result |
|---|---|---|
| FF | =HEX2DEC(A2) | 255 |
| 1A3F | =HEX2DEC(A3) | 6719 |
| FFFFFFFFFF | =HEX2DEC(A4) | -1 |
Results calculated in Excel.
Mistakes people make
| Mistake | What to do instead |
|---|---|
| 10 hex digits starting with F | These are negative (two's complement) |
| 0x prefix | Remove it first |
Related functions
📚 Part of the free Excel course: Beginner → Expert · Try it in the Formula Lab or ask the AI Helper.
Test formulas dynamically in our web formula laboratory or download the companion Excel workbook.
📎 Practice files for this article
- 📗Practice workbook: Engineering & conversion15 tasks on realistic sales data — type your formula, the Check column turns green when it is right. Answers sheet included.⬇ XLSX · 34 KB
Free to use for learning. Files with macros (.bas) are plain text — import them with Alt+F11 → File → Import File, and always test on a copy.
Atul (AJ) builds office-automation and local-first AI tools as Atulya AI, and works with Excel, SAP and Oracle EPM every day. He writes about the shortcuts, macros and automations that actually save time — plus the occasional wacky fact. Videos on YouTube: Lazy Automator AI (@LazyAutomatorAI).
More posts by Atul →Build this skill next
This page is a quick function reference. Use it for syntax, then practise the function in a broader workflow.
Stuck on a step? Ask a question and the AI answers using this article.