Unique random numbers from a set of numbers

nah225

New Member
Joined
Jul 13, 2004
Messages
17
Hi there,

I have searched this board numerous times and have tried numerous codes to try and get what I'm looking for but I have yet to get exactly what I want/need.
I have a list of customer #'s in Column A and I want to get a series of random customers based on Column A without any duplicates in Column B.
I don't have a fixed amount of numbers that I'm trying to pull as the list of customers may change.

Pleeeeease help.

Thanks,Nicole
 
micahs_10,

Thanks - so far it seems to be working using a small list of about 10 customers. I'll let you know how it works when I have a larger list.

Nicole
 
Upvote 0

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Book3
ABCD
1Sample40%
2Size5
3Cust#RandRankSample
41725480.2779457190440
51901478.58E-0512191472
61904400.669511191558
71904430.4382685191815
81908650.06200210190443
91913670.0747229 
101914500.03445311 
111914720.615012 
121915580.6098453 
131917780.0766398 
141918150.4696894 
152000720.414836 
Sheet1


Formulas...

B4, copied down:

=IF(ISNA(MATCH(A4,$A$3:A3,0)),RAND(),"")

C4, copied down:

=IF(N(B4),RANK(B4,$B$4:$B$15),"")

D1: 40%

Sample size expressed as a percentage of the population of interest.

D2:

=ROUNDUP(COUNT(A4:A15)*D1,0)

Calculates the sample size, using D1.

D4, copied down:

=IF(ROW()-ROW(D$4)+1<=$D$2,INDEX($A$4:$A$15,MATCH(ROW()-ROW(D$4)+1,$C$4:$C$15,0)),"")

Constructs a random sample of customers.

Audit the result list with:

=SUMPRODUCT((D4:D15<>"")/COUNTIF(D4:D15,D4:D15&""))=COUNT(D4:D15)

TRUE as result means: the sample is OK (without duplicates).
 
Upvote 0
Are you sure you put in C2 =RANK(B2,$B$2:$B$10) with the $'s and not =RANK(B2,B2:B10)?

0.671974 and 0.663945 should not both be ranked 11
 
Upvote 0
I must have screwed up the formula you gave me Oaktree because it's working now...thanks micahs_10. I also tried the formula that Aladin Akyurek sent and that also works (once I do some tweeking with my # of customers and sample size....

Thanks for all of your help -I'm going to have lotsa fun!

Nicole
 
Upvote 0
Thanks - I tried those two, and neither worked how I needed them to..the 2nd one gave me 0s sometimes and the first one put everything going across rather than in a column.
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,267
Members
449,075
Latest member
staticfluids

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