Random Number

Iccreamann21

New Member
Joined
Sep 25, 2013
Messages
41
Office Version
  1. 365
Platform
  1. Windows
I'm looking for a formula that will pick a random number, but consider using the number used the least.

Names:
30ish enteries

Weeks:
52 weeks

Numbers:
1-100

The goal is to use all 100 numbers before recycling them. Thank you, your help is much appreciated!

namesweek 1week 2week 3week 4
mike8834233
bill1678558
dave2363278
matt76852421
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
@Iccreamann21
I think you can infer from the lack of response that this is not as easy as it might sound.
Certainly not by way of a formula.
One thing to bear in mind is that the randomising formulas are 'Volatile' and, as such, they re-calculate every time your sheet calculates. So direct use in formulas would likely yield ever changing results.
I would imagine that you are wanting the random picks to stay stable?
I have half a notion of how you might use formulas to generate your random numbers but it would then require you to copy / paste the generated values to your data columns.
No promises but if something along those lines is acceptable to you then I will see if I can actually achieve it.
Otherwise, you will need to employ a vba Macro.
Is this up to 30 numbers generated each week or a full year of weeks generated as a one off?
Is 30 a realistic maximum ?
 
Upvote 0
@Iccreamann21
I think you can infer from the lack of response that this is not as easy as it might sound.
Certainly not by way of a formula.
One thing to bear in mind is that the randomising formulas are 'Volatile' and, as such, they re-calculate every time your sheet calculates. So direct use in formulas would likely yield ever changing results.
I would imagine that you are wanting the random picks to stay stable?
I have half a notion of how you might use formulas to generate your random numbers but it would then require you to copy / paste the generated values to your data columns.
No promises but if something along those lines is acceptable to you then I will see if I can actually achieve it.
Otherwise, you will need to employ a vba Macro.
Is this up to 30 numbers generated each week or a full year of weeks generated as a one off?
Is 30 a realistic maximum ?
Snakehips,

Thank you for the reply. I kind of figured this would be the case, but I know we have some strong outside-of-the-box members on the forums such as yourself.

You are correct, I would need the numbers to stay stable for record purposes. If your suggestion of copy/paste generated values is achievable, I would be greatly appreciative. Unfortunately for me, due to security reasons, VBA macro is a security risk and is blocked from computers on the network.

The exact number of employees is 50 and each week they would receive a number between 1-95. The numbers would need to be generated weekly and each number would have to be distributed before they are able to be recycled and used again.

Let me know your thoughts and I most definitely appreciate you taking your time to help me with this task.
 
Upvote 0
@Iccreamann21 Ok, leave me to have a think and a play, 🤞

Would you want the 'Random Generator' on a separate sheet or same sheet as the record of picks?
 
Upvote 0
Ok. Another thought / question.
Will the list of 50 employees always be full?
Will there be some weeks when certain employees might be excluded from attracting a random number?
 
Upvote 0
@Iccreamann21 Where to begin ? Other than I must want my bumps read, having wrestled with this!!!!

Below is my best effort which hopefully will do what you want.
It has two elements of randomisation and should ensure that each batch of numbers 1 - 95 is fully used before introducing a new batch.
I have tested it but it now needs someone with a less frazzled brain to take a calm look.

The 'Random Picks' tab:
Can be renamed if you wish.
Has a Named Range ‘Picks’ - which is 52 Week columns x 50 Employee rows.
Column A. Set ‘Y’ to include or ’N’ to exclude employee(s) from the current pick.
Clear Contents of week column(s) to do re-pick.

The ‘Generator’ tab:
This tab is perhaps best kept protected. Currently no password.
Helper columns A :N can be hidden if required.
N reflects the inclusion choices made in column A of the Random Picks tab.
To generate a new set of picks just force calculation by hitting F9 key.
Then Copy the green range P2:P51, inclusive of any blanks, and Paste Special/Values into the appropriate column of the Random Picks tab.
Immediately you do that, the Generator will re-calculate and so you could Paste new values into next week column if you wish.
When done, double click on any cell to cancel Cut/Copy mode which will stop the marching ants border in Generator tab.
You can can double click in the Generator tab but that will need you to dismiss a pop up protection Alert.

I think that’s about it?
I hope the following XL2BB Mini Sheets reflect everything.
In the Generator tab, drag the formulas in A55:B55. and D55:F55 down to row 96.

RandomXl.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAYAZBABB
1IncludeEmployeeWeek 1Week 2Week 3Week 4Week 5Week 6Week 7Week 8Week 9Week 10Week 11Week 12Week 13Week 14Week 15Week 16Week 17Week 18Week 19Week 20Week 21Week 22Week 23Week 24Week 25Week 26Week 27Week 28Week 29Week 30Week 31Week 32Week 33Week 34Week 35Week 36Week 37Week 38Week 39Week 40Week 41Week 42Week 43Week 44Week 45Week 46Week 47Week 48Week 49Week 50Week 51Week 52
2YMike4378381228580828958
3YBill57683739556357843975
4NDave559346827636798722
5NMatt58415222757158157
6YEmp62483873867412168669
7YEmp75014408511216354460
8YEmp8369131285944754991
9YEmp97862766315685229044
10YEmp1048172414189074583
11NEmp11408044433094451770
12YEmp122164195291921426242
13YEmp1392395194156166144024
14YEmp144566301388644625315
15YEmp1577607875687970343211
16YEmp1633225481358862619
17YEmp1719611593491461272565
18YEmp188552364278485878
19YEmp1944848968834353938510
20YEmp202937867234252368226
21YEmp215317246651218292066
22YEmp228175593389571328314
23YEmp2315941160542495778143
24YEmp243320507388173498872
25YEmp258374809260538912846
26YEmp2655920347537261439
27YEmp27889355873255059527
28YEmp2870301677356664437986
29YEmp2976632353392813236987
30YEmp30182714263440624167
31YEmp318938699087728697447
32YEmp322346145440937121729
33YEmp334627486164524484552
34YEmp345695914777955618664
35YEmp3573263263264860605177
36YEmp3649226212479372633413
37YEmp3734278487825144155390
38YEmp381035556841119556836
39YEmp39874264973994335456
40YEmp401328452632028373515
41YEmp4179471861174183213661
42YEmp4272121912033922693
43YEmp4390541750676838307371
44YEmp4451827671905988941635
45YEmp456525225133763192738
46YEmp46166214669107249251
47YEmp476749798091357846914
48YEmp4869832918926791592350
49YEmp4911701070626531677683
50YEmp5071885510525547448479
51YCharlie31576532449230788089
Random Picks
Cells with Data Validation
CellAllowCriteria
A2:A51ListY,N



RandomXl.xlsx
ABCDEFGHIJKLMNOP
1Random Root NumberRandom Rank 1 - 95Priority Pick RefPrioritiy Pick Priority Number IndexTop-up Number IndexPriority PickTop-up IndexAll PicksRandom For Distribution Distribution RankDistribution IndexEmployee Included Copy Paste Special/Values
20.390060338665TRUE199966-660.738383932351TRUE19
30.36965020868TRUE299968-680.746208527362TRUE57
40.9610296597TRUE3999 - 99948 FALSE 
50.38627838867FALSE9994 - 99948 FALSE 
60.29577361674TRUE59997-70.724352081343TRUE54
70.48932920554TRUE699974-740.84071085414TRUE59
80.16899239388TRUE799954-540.03300502935TRUE56
90.79046474222TRUE899988-880.589940017236TRUE93
100.06157379192TRUE999922-220.602260493257TRUE94
110.26299050879FALSE99910 - 99948 FALSE 
120.74306650131TRUE1199992-920.644786738308TRUE33
130.63933230340TRUE1299931-310.7846525379TRUE34
140.17707754887TRUE1399940-400.3469862231310TRUE72
150.75357300729TRUE1499987-870.8297281993911TRUE71
160.85262196414FALSE9991529-290.8956281474412TRUE9
170.46555107857TRUE1699957-570.016852687213TRUE40
180.71225718334TRUE1799934-340.201245242914TRUE95
190.2685234978TRUE1899978-780.5707722162115TRUE76
200.89434949710TRUE1999910-100.8441560454216TRUE13
210.77593406126FALSE9992021-210.6364637612817TRUE80
220.79310534421TRUE2199995-950.3596179181418TRUE20
230.02066661495TRUE2299993-930.12135144619TRUE38
240.12982302490FALSE9992347-470.5963807312420TRUE43
250.06073849493TRUE2499982-820.97897064721TRUE78
260.57015392247TRUE2599994-940.133826455722TRUE41
270.71207816436FALSE9992632-320.7131760283323TRUE88
280.32985882269FALSE9992780-800.4937740181724TRUE47
290.22756428382TRUE289999-90.3113033881225TRUE22
300.04066716294TRUE2999916-160.8377948184026TRUE84
310.76772435627FALSE9993056-560.116382289527TRUE63
320.73711652432TRUE3199965-650.9436611084528TRUE21
330.59382354846FALSE9993238-380.5151144741929TRUE11
340.25326191680TRUE3399919-190.00900903130TRUE92
350.8944299479TRUE3499941-410.5800280452231TRUE49
360.83416321816TRUE3599972-720.2285213231032TRUE28
370.47541620356TRUE3699928-280.6722545873233TRUE32
380.40725144465TRUE3799913-130.484122081634TRUE7
390.46455644658FALSE9993820-200.4986971681835TRUE66
400.67545047738TRUE3999943-430.527725892036TRUE68
410.81221445419TRUE4099971-710.2687861481137TRUE31
420.22666419183FALSE9994111-110.6441548052938TRUE70
430.63827677241TRUE4299912-120.9699892894639TRUE87
440.85010715315FALSE9994370-700.8152258943840TRUE16
450.31417629472TRUE4499976-760.4505632971541TRUE74
460.767688628TRUE4599955-550.8834495294342TRUE10
470.86121818413TRUE4699949-490.6616025233143TRUE55
480.80962560420TRUE4799959-590.093517211444TRUE29
490.63263090343TRUE4899933-330.19834459845TRUE65
500.32354283571TRUE4999963-630.6356267452746TRUE12
510.88678661111TRUE5099984-840.6207112042647TRUE82
520.1559606389FALSE99951 
530.88240089812TRUE52999 
540.6715098439FALSE99953 
550.20334877986FALSE99954 
Generator
Named Ranges
NameRefers ToCells
Picks='Random Picks'!$C$2:$BI$52D2:D55, C2
 
Upvote 0
Solution
@Snakehips You are amazing! Thank you so much. After a long holiday weekend, I returned to work and immediately added your creation to my worksheet and it works like a champion! Thank you again. You are a champion!
 
Upvote 0

Forum statistics

Threads
1,214,940
Messages
6,122,352
Members
449,080
Latest member
Armadillos

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