Convert ASCII to Hex

S

Scott Sanford

Hi,
I'm not very proficient in Excel, so this may not even be possible....

I do network administration and often find myself having to type in a WEP
key in HEX which, especially on a PDA, can be a time consuming task.

I was looking to have an excel spreadsheet (pocket excel to be specific)
that can convert the ASCII text in one cell to HEX in another.
A great "extra" bonus would be that you HAVE to use either 13 or 26
characters.

Anyone know of a function that could accomplish this?
Thanks so much,
STS
 
R

Ron Rosenfeld

Hi,
I'm not very proficient in Excel, so this may not even be possible....

I do network administration and often find myself having to type in a WEP
key in HEX which, especially on a PDA, can be a time consuming task.

I was looking to have an excel spreadsheet (pocket excel to be specific)
that can convert the ASCII text in one cell to HEX in another.
A great "extra" bonus would be that you HAVE to use either 13 or 26
characters.

Anyone know of a function that could accomplish this?
Thanks so much,
STS


To restrict your entries to 13 or 26 characters, use Data/Validation
Allow: Custom
Formula =OR(LEN(E1)=13,LEN(E1)=26)

(Change E1 to whatever your entry cell is)

If you select a number of cells, the data validation will apply to all of them.


One potential issue with conversion is that there may be more than one
conversion algorithm.

However, given the routine where the HEX number is the concatenated version of
the ASCII code, the following UDF will accomplish that:

--------------------------------
Function WEPConv(str As String) As String
Dim i As Long

For i = 1 To Len(str)
WEPConv = WEPConv & Hex(Asc(Mid(str, i, 1)))
Next i

End Function
------------------------------

To enter this routine, <alt-F11> opens the VB Editor.
Ensure your module is highlighted in the Project Explorer window, then
Insert/Module and paste the code into the window that opens.

To Use the routine, enter the formula =WEPConv(E1) (or whatever cell reference)
into some cell on the worksheet.


--ron
 
H

Harlan Grove

Ron Rosenfeld wrote...
....
One potential issue with conversion is that there may be more than one
conversion algorithm.

Meaning big vs little endian and word length?
However, given the routine where the HEX number is the concatenated version of
the ASCII code, the following UDF will accomplish that:
....

Does Pocket Excel provide UDFs? If not, it'd still be possible to do
this with a single formula per source cell *IF* Pocket Excel supported
named array-valued expressions and formulas up to 1024 characters in
length. Otherwise, it'd take several formula cells per each source cell
to do this.
 
R

Ron Rosenfeld

Does Pocket Excel provide UDFs? If not, it'd still be possible to do
this with a single formula per source cell *IF* Pocket Excel supported
named array-valued expressions and formulas up to 1024 characters in
length. Otherwise, it'd take several formula cells per each source cell
to do this.

Thanks for asking.

I just now had the opportunity to try it and Pocket Excel does not support
UDF's. So if the OP wanted to use the UDF, he'd have to do it on the desktop
version.

I don't know about support for named array-valued expressions or formulas. I
find HELP for Pocket Excel to be quite limited, and I do not see a list of
specifications. I have to go out of town so will not have an opportunity to
experiment.

Looking through the available formulas, I do not see a CODE function or a HEX
function either.

Best,

--ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top