View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
marcus marcus is offline
external usenet poster
 
Posts: 32
Default Coverting Alphabets into Numbers

Thank you all. From the examples, I was also able to figure out how to
"encrypt" it back to alphabets.

Thanks!

"Joel" wrote:

Try this function. It will give you the decoded total for any range of cells
you choose.

=decodenum(A1:B5)

Function decodenum(Target As Range) As Integer

Total = 0

For Each cell In Target


Subtotal = 0
For Count = 1 To Len(cell)
Subtotal = (10 * Subtotal) + _
((Asc(Mid(cell, Count, 1)) - Asc("A") + 1) Mod 10)

Next Count

Total = Total + Subtotal
Next cell
decodenum = Total
End Function


"Marcus" wrote:

I hope someone can help me with this.

I have a column of "encrypted" data (in excel), which needs to be converted.
The data in each cell is "encrypted" by following this simple rule:

A = 1
B = 2
C = 3
D = 4
E = 5
F = 6
G = 7
H = 8
I = 9
J =0

Therefore, if a cell has "BFDJ", the numerical value will be 2640.

My problem is this:

How can I take the sum of the "encrypted" data in the column to make a grand
total, which is also encrypted using the above rule?

I've looked around and it seems that there are functions which can change
numbers into words, but not the other way round.

Any assistance is much appreciated.