how to encrypt numbers in excel

jatin78

New Member
Joined
Feb 23, 2016
Messages
3
i want to encrypt numeric data ie (1 = a, 2 = b, 3 = c ......... 0 = j) now for number 123 i want return values as abc can anybody please help urgent
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Try this:

Excel 2010
ABC
1OriginalEncryptedDecrypted
2abdxxxQQXabd
3123xxx123
449687xxx
49687
5yjm5616-651yuxxxIY_ KEyjm5616-651yu

<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
B2=XorC(A2,123)
C2=XorC(B2,123)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>




VBA Express : Excel - Encrypt and decrypt strings using a Xor algorithm

If you definitely want to return abc then we can put something together although due to it's simplicity it would seem pointless to encrypt it in the first place.
 
Last edited:
Upvote 0
Thanks for your reply Bro. but it is'nt what i need...,

say for eg i have BLACK WHITE as my encrypter where numeric values are from 1 to 0............ " B = 1, L = 2, A = 3 and so on till E = 0" now if i enter 750 in cell a2 i want to create a function which returns "HKE" max no. of digits will be 6 please help as need urgently...

Thanks in advance
 
Upvote 0

Excel 2010
AB
2750HKE
Sheet2
Cell Formulas
RangeFormula
B2=Enc(A2,"BLACKWHITE")


Code:
Function Enc(sData As String, sKey As String)
Dim temp As String
Dim i As Long
If Len(sKey) > 10 Then Enc = "Invalid Key Length"


For i = 1 To Len(sData)
    temp = temp & Mid(sKey, Replace(Mid(sData, i, 1), "0", "10"), 1)
Next i


Enc = temp
End Function
 
Upvote 0
My slight variation.

I think that a short key length is more of a problem than a long one.
Also, Comfy, your "Invalid Key Length" never gets returned does it?

Rich (BB code):
Function Encr(sData As String, sKey As String) As String
  Dim i As Long
  
  If Len(sKey) < 10 Then
    Encr = "Ivalid key length"
  Else
    sKey = Mid(sKey, 10, 1) & sKey
    For i = 1 To Len(sData)
      Encr = Encr & Mid(sKey, Mid(sData, i, 1) + 1, 1)
    Next i
  End If
End Function


Excel Workbook
AB
1750HKE
2901256TEBLKW
33265Ivalid key length
Sheet2
 
Upvote 0
Sorry for re-opening this post after a long time.
I'm a very new to VB coding in excel sheets..
Can you please explain in detail how to implement this code.

I can see that u created a new formula named "ENC" using the VB code... but i need a step by step guidance
 
Upvote 0
Can you please explain in detail how to implement this code.
Welcome to the MrExcel board!

To implement ..
1. Right click the sheet name tab and choose "View Code".
2. In the Visual Basic window use the menu to Insert|Module
3. Copy and Paste the function code into the main right hand pane that opens at step 2.
4. Close the Visual Basic window.
5. Enter the formula as shown in the screen shot in post 6. Hover over (or click) B1, B2 or B3 in that screen shot to see (or copy) the formula.
6. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm)
 
Upvote 0

Forum statistics

Threads
1,217,415
Messages
6,136,506
Members
450,017
Latest member
Alvi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top