ASCII text to Hexadecimal in Excel
27,672
Please try:
=DEC2HEX(CODE(MID(A1,1,1)))&DEC2HEX(CODE(MID(A1,2,1)))&DEC2HEX(CODE(MID(A1,3,1)))&DEC2HEX(CODE(MID(A1,4,1)))
In your version you might need the .
s in the function (and perhaps ;
s rather than ,
s).
Author by
Nico
Updated on March 23, 2020Comments
-
Nico about 4 years
I want to this but i don't know what to do, the only functions it seems to be useful is "DEC.TO.HEX".
This is the problem, i have in one cell this text:
1234
And in the next cell i want the hexadecimal value of each character, the expected result would be:
31323334
Each character must be represented by two hexadecimal characters. I don't have an idea how to solve this in excel avoiding make a coded program.
Regards!
Edit: Hexadecimal conversion
Text value Ascii Value (Dec) Hexadecimal Value 1 49 31 2 50 32 3 51 33 4 52 34
-
Nico about 9 yearsThanks @pnuts, I though to do that but I really don't know the length of the string. In this case "1234" has four characters, but if i write another value with different length your formula won't work.
-
cde almost 7 yearsThis only applies to the first character.
-
cde almost 7 yearsThis is perfect for fixed ranged values. I padded simply by manually adding in my 000 pad as 303030etc.
-
cde almost 7 yearsThis only does half the job. OP wanted Ascii Hex values, not Ascii Decimal values. Ascii Char 1 = Decimal 49 = Hex 31.