# Decimal to Hexadecimal conversion - Using Asset Analysis

Blog Post created by wpribula on Jan 12, 2017

I received the question about how to convert Decimal number to Hexadecimal. I found that it is easy using ACE or custom Data Reference.

However this can be done using AF Analysis too. See my example for 6 digit HEX number:

And here are rows of the Analysis:

```mod6 = 'Input' Mod Pow(16,6)
mod5 = mod6 Mod Pow(16,5)
mod4 = mod5 Mod Pow(16,4)
mod3 = mod4 Mod Pow(16,3)
mod2 = mod3 Mod Pow(16,2)
mod1 = mod2 Mod Pow(16,1)
dig6 = floor (mod6 / Pow(16,5))
dig5 = floor (mod5 / Pow(16,4))
dig4 = floor (mod4 / Pow(16,3))
dig3 = floor (mod3 / Pow(16,2))
dig2 = floor (mod2 / 16)
dig1 = floor (mod1)
string6 =   if dig6 = 15 then "F" else
if dig6 = 14 then "E" else
if dig6 = 13 then "D" else
if dig6 = 12 then "C" else
if dig6 = 11 then "B" else
if dig6 = 10 then "A" else
String(dig6)
string5 =   if dig5 = 15 then "F" else
if dig5 = 14 then "E" else
if dig5 = 13 then "D" else
if dig5 = 12 then "C" else
if dig5 = 11 then "B" else
if dig5 = 10 then "A" else
String(dig5)
string4 =   if dig4 = 15 then "F" else
if dig4 = 14 then "E" else
if dig4 = 13 then "D" else
if dig4 = 12 then "C" else
if dig4 = 11 then "B" else
if dig4 = 10 then "A" else
String(dig4)
string3 =   if dig3 = 15 then "F" else
if dig3 = 14 then "E" else
if dig3 = 13 then "D" else
if dig3 = 12 then "C" else
if dig3 = 11 then "B" else
if dig3 = 10 then "A" else
String(dig3)
string2 =   if dig2 = 15 then "F" else
if dig2 = 14 then "E" else
if dig2 = 13 then "D" else
if dig2 = 12 then "C" else
if dig2 = 11 then "B" else
if dig2 = 10 then "A" else
String(dig2)
string1 =   if dig1 = 15 then "F" else
if dig1 = 14 then "E" else
if dig1 = 13 then "D" else
if dig1 = 12 then "C" else
if dig1 = 11 then "B" else
if dig1 = 10 then "A" else
String(dig1)
Result = concat("0x",string6,string5,string4,string3,string2,string1)
```