(EDIT: Solution improved based on Arjan's comment)
Here is a simple but dirty MS Excel solution.
Assumption: Data is in the format 28 01 AF 01 XX XX XX XX YY YY YY YY...
(space separated)
- Copy data to A1.
- Enter in B1:
=MID($A$1, ROW(B1)*12-11, 11)
. Copy it down to B2:B20.
- Enter in C1:
=MID(B1,10,2)&MID(B1,7,2)
. Copy it down to C2:C20.
- (a) Enter in D1:
=HEX2DEC(LEFT(B1,2))
. Copy it down to D2:D20.
(b) If #NAME?
error appeared, then enter the following in D1. Copy it down to D2:D20.
=IF(CODE(LEFT(B1,1))>64,CODE(LEFT(B1,1))-55,LEFT(B1,1))*16
+IF(CODE(MID(B1,2,1))>64,CODE(MID(B1,2,1))-55,MID(B1,2,1))
(Another assumption for solution (b): all the HEX values are in capital letter)
Column C & D would be what you need.
Explanation
B:B breaks data (A1) into different rows.
C1 simply extracts the characters in position {10, 11, 7, 8} from B1.
D1 extracts the first 2 characters in A1, and then convert it from HEX to DEC.
Note: Analysis ToolPak add-in is required for HEX2DEC()
in (a). If #NAME?
error appears, it means that the function is not supported. In this case, the hack in (b) would help to convert from HEX to DEC.
CODE()
gets the ASCII code of the character. For ABCDEF, their ASCII codes are {65,66,67,68,69,70}. CODE()-55
then returns {10,11,12,13,14,15}.
1what is the question now? how to put that into excel or ... how to treat the repetition of the string (or the item '01af')? – akira – 2010-12-06T10:27:51.970
I'm not 100% I got it right, but I fixed the title to better summarize the question. Please use the "edit" link to change it if it's not okay. (Hence: please answer akira's comment by editing the question.) – Arjan – 2010-12-06T10:39:06.963
Thank you, this is my first time doing this, I'm not quite sure on the terminology itself. All I'm trying to do is extract game data from its hex structure that I've found. – FlavorOfLife – 2010-12-06T11:42:56.757
...the new example does not make it much clearer to me. First of all, you've selected 21 values? And is it indeed just one line you're processing? – Arjan – 2010-12-06T12:00:12.167