We can use function method and VBA method to solve the above or similar problems.
To put it bluntly, the so-called sampling is nothing more than a question of taking random numbers.
First, sampling is realized by function.
If you don't know VBA, you can use the following deliberate loop operation method, but in theory 100% will not succeed, and there are too many numbers, which is time-consuming.
a 1 input = if(sum($ b $ 1:$ b $ 100)< & gt; 100,INT(RAND()* 1000+ 1),A 1)
b 1 input = countif($ a $ 1:$ a 4 100,a 1)。
Drag A 1:B 1 to A 100:B 100.
Then execute the menu operation: Tools → Options → Calculation → Repeat operation; Tick → Maximum times 10000 → OK, A 1:B 100 will be calculated all the time.
If10000th operation is unsuccessful, you can press F9 again to perform the operation until it is successful; If successful, you should immediately paste A 1:A 100, clear the contents of B 1:B 100, and unhook and repeat the operation.
Secondly, VBA sampling method is adopted.
The condition is: from 1 to 1000, select 100 non-repetitive random numbers (positive integers).
Because non-repetitive variables are needed, it must be judged by loop program.
The easiest way is to execute a macro. Using the following code, 100 non-repeating variables will be immediately displayed in A 1: A 100.
Sub My sampling ()
Dim xx( 1 to 1000) is an integer.
For t = 1 to 100.
Relander:
x = Int(Rnd() * 1000 + 1)
If xx (x) >; 0 and then go to re-landing.
r = r + 1
Cell (r, 1) = x
xx(x) = r
then
End joint