# Number Conversion to Code

Closed
Hayseed - Nov 24, 2015 at 10:29 AM
TSCGCobra043
Posts
7
Registration date
Monday December 14, 2015
Status
Member
Last seen
December 16, 2015
- Dec 14, 2015 at 04:52 PM
Hello,

Hello,
I appreciate any and all who may give this issue some consideration.

This is to change a number to a code of letters to hide info in plain site.
if my code table is 1 = C, 2 = D, 3 = E, etc thru 9 = K and 0 = P
so if my cost shows as 24.76 it returns DFIH
or " " 130.90 " " CEPKP
So I can then print this letter code on my tag, thus knowing my cost without my clients figuring it out.

Please comment if you are aware of a solution.

Put this in a module:
```Function numbertocode(mycell As Range) As String
Dim n As Integer

'           1234567890
codelist = "PCDEFGHIJK"

For n = 1 To Len(CStr(Format(mycell, "0.00")))
If Mid(mynum, n, 1) <> "." Then numbertocode = numbertocode & CStr(Mid(codeist, Val(Mid(mynum, n, 1)) + 1, 1))
Next n

End Function

```

To use it in a sheet, put this in a cell, where A2 is the cell containing value to convert:

`=numbertocode(A2)`
TSCGCobra043
Posts
7
Registration date
Monday December 14, 2015
Status
Member
Last seen
December 16, 2015

Dec 14, 2015 at 04:52 PM
how would you do this in a cell?