ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   random numbers from a data of numbers? (https://www.excelbanter.com/excel-worksheet-functions/28368-random-numbers-data-numbers.html)

MaryEng

random numbers from a data of numbers?
 
Can anyone provide an effective Excel function for obtaining random numbers
based on a set of known random numbers?

Naz

1) Randbetween(lower,upper) formula
2) if You have a list of random numbers u could put a number to the left of
that column and the create a vlookup based on a random number to pull back
that number

=vlookup(randbetween(1,6),$A$1:$A$6,2,false)

A B
1 R1
2 R2
3 R3
4 R4
5 R5
6 R6

IF you have something else in mind post back

_______________________
Naz,
London


"MaryEng" wrote:

Can anyone provide an effective Excel function for obtaining random numbers
based on a set of known random numbers?


JE McGimpsey

Not sure what "obtaining random numbers based on a set of known random
numbers" means, exactly, but if you have a set of random numbers, you
can use the technique he

http://www.mcgimpsey.com/excel/randint.html

to get a random sampling of them.

Say your randoms were in A1:A100. You could get a random sample of 10 by
array-entering

=INDEX(A:A,RANDINT(1,100))

In article ,
"MaryEng" wrote:

Can anyone provide an effective Excel function for obtaining random numbers
based on a set of known random numbers?


JE McGimpsey

Note that RANDBETWEEN() will not guarantee unique values.


In article ,
Naz wrote:

1) Randbetween(lower,upper) formula
2) if You have a list of random numbers u could put a number to the left of
that column and the create a vlookup based on a random number to pull back
that number

=vlookup(randbetween(1,6),$A$1:$A$6,2,false)


Bernd Plumhoff

Your algorithm is still calculating nEnd - nStart + 1 random numbers and not
only the number of requested ones, I think.

I suggest to take my function UniqRandInt() at www.sulprobil.com.

Regards,
Bernd



JE McGimpsey

No. When array-entered, the function returns the same number of ints as
cells.

Perhaps I should have been explicit that the formula I gave

=INDEX(A1:A100,RandInt(1,100))

should be entered in 10 cells, as shown in the example on the referenced
site?


In article ,
"Bernd Plumhoff" wrote:

Your algorithm is still calculating nEnd - nStart + 1 random numbers and not
only the number of requested ones, I think.


Bernd Plumhoff

Sorry, but: yes.

Your algorithm CALCULATES nEnd - nStart + 1 random numbers and RETURNS the
number of requested random ints.

So, if you array-enter 10 cells with =RANDINT(1,1000000), for example, your
algorithm calculates 1,000,000 random ints and finally returns 10. That's not
necessary, I thought.

Regards,
Bernd


All times are GMT +1. The time now is 02:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com