Random number generator without the Rand function

jammoca

Banned
Joined
Nov 6, 2002
Messages
1,100
In the past I have used the following two formulae at different times to generate random numbers based on people's names in column A (eg: Sanders, Matthew or Jamieson, Chris) .....

=VLOOKUP(MID(A5,FIND(" ",A5)-2,1),Lookups!$B$2:$C$27,2)&VLOOKUP(MID(A5,FIND(" ",A5)-1,1),Lookups!$B$2:$C$27,2)&VLOOKUP(MID(A5,FIND(" ",A5)+1,1),Lookups!$B$2:$C$27,2)&VLOOKUP(MID(A5,FIND(" ",A5)+2,1),Lookups!$B$2:$C$27,2)

=SUM(CODE(RIGHT(A2,1)),CODE(RIGHT(A2,4)),CODE(RIGHT(A2,9)),CODE(A2))/(4*122)

However, there is frequently duplication of the random number generated.

Is there a way to generate random numbers, without using the Rand function, that will rarely give duplicated numbers ?

I don't want to use the Rand function as it keeps changing each time a calculation is made, and I need the randomly generated number to never change once allocated to a person.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Obviously the more 'samples' you take from the name, the more unique the number will be but if two people have exactly the same name, that will produce exactly the same number.

Do you have any other information about the person such as his date of birth, postal address, postcode, telephone number, etc, elements of which could be included?

Is there a preferred limit to the length of the number?

Does a person's record always stay on the same row (so we could use ROW() in some way) or might it move?

Are you willing to resort to VBA? (I'm thinking about a user-defined function.)

Could you use RAND() to generate a number and then 'fix' it by doing a Paste Special Values? (This could be done automatically by VBA and would be my preferred solution.)
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,839
Members
452,948
Latest member
UsmanAli786

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