Number encryption

paulsolar

Well-known Member
Joined
Aug 21, 2013
Messages
691
Office Version
  1. 365
Hi All

I'm after a bit of advice please. I expect someone has done this before.

I have a list of 1000's of unique numbers between 1 and 6 digits that I want to increase all of to 8 digits. The problem is that I cant keep the existing numbers in the same order as they would be easy to guess.

Ideally what I'd like to do is have something that will change the numbers to 8 digits with the numbers still remaining unique. And then a method so it can be reversed back to it's original format if required.

I've looked into moduls checking type methods and some other methods but they are a massive overkill for what I require. All I'm trying to do is convert existing membership numbers to a new format for membership cards that require 8 digits.

Kind regards

Paul
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Easiest way might be a simple BITXOR with some padding:


Book1
ABC
1Key:00192837
2Old ValueNew ValueAnd back again
312345612014776123456
400053401933634000534
599999998979149999999
Sheet3
Cell Formulas
RangeFormula
B3=INT(A3/10^5)*10^7+BITXOR(A3,$B$1)*10+MOD(A3,10)
C3=BITXOR(MOD(INT(B3/10),10^6),$B$1)


WBD
 
Upvote 0
Brilliant thanks, I've never come across this before, what a brilliant function.
 
Upvote 0
Hi WBD

I've managed the padding and formatting (probably a better way of doing it but it's working)

But I'm having a nightmare with the un-ecryption as I've never tried this before.

Sorry to be a pain, could you help me with this please.

cheers

Paul

="PI - "&IF(LEN(INT(A3/10^5)*10^7+BITXOR(A3,$B$1)*10+MOD(A3,10))=7,"0"&INT(A3/10^5)*10^7+BITXOR(A3,$B$1)*10+MOD(A3,10),IF(LEN(INT(A3/10^5)*10^7+BITXOR(A3,$B$1)*10+MOD(A3,10))=6,"00"&INT(A3/10^5)*10^7+BITXOR(A3,$B$1)*10+MOD(A3,10),IF(LEN(INT(A3/10^5)*10^7+BITXOR(A3,$B$1)*10+MOD(A3,10))=8,INT(A3/10^5)*10^7+BITXOR(A3,$B$1)*10+MOD(A3,10))))
 
Upvote 0
Yuck. I just created a custom format for the cells with eight zeroes. Use the original formula, then higlight the column that is supposed to be eight digits. Press Ctrl+1, go to the Number tab, select Custom and type in 00000000

That will pad the numbers for you.

WBD
 
Upvote 0

Book1
ABC
1Key:192837
2Old ValueNew ValueAnd back again
3123456PI - 12014776123456
4534PI - 01933634534
5999999PI - 98979149999999
Sheet1
Cell Formulas
RangeFormula
B3="PI - "&TEXT(INT(A3/10^5)*10^7+BITXOR(A3,$B$1)*10+MOD(A3,10),"00000000")
C3=BITXOR(MOD(INT(RIGHT(B3,8)/10),10^6),$B$1)


WBD
 
Upvote 0
Hi

Compared to your solution "Yuck" is an understatement!!

Brilliant thanks, I'm going to read up on this tonight. looks like it may come in handy in the future.

Thanks again for your time

cheers

Paul
 
Upvote 0
Hi Wideboy

I've just worked out how this is working, absolutely brilliant bit of work. To say I'm mega impressed would be an understatement.

cheers

Paul
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,853
Members
452,361
Latest member
d3ad3y3

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