+ Reply to Thread
Results 1 to 6 of 6

Randbetween exactly some values in excel ?

  1. #1
    Registered User
    Join Date
    06-02-2012
    Location
    Romania
    MS-Off Ver
    Excel 2010
    Posts
    95

    Randbetween exactly some values in excel ?

    Hello !

    In excel there is randbetween(x;y) which display random numbers between exactly given interval. e.g. randbetween(1;23) will give you random number between 1 and 23.
    The question is how do you get random numbers from exactly given ones ?

    e.g. Let's say you want excel to return random numbers between 1;12;23;35;37;45;53;75;95 and it should return to you only random chosen numbers from this given 'array' like 1 OR 12 OR 23 OR 35 OR 37 OR 45 OR 53 OR 75 OR 95 ONLY ONE number if you want to return only one but if you want it to return more then one then it should be: 1;12 OR 1;35 OR 1;53 if you want to return 2 of them and so on. It should be a formula like:
    randbetween("values";"chosen by") eg. randbetween("1;12;23;35;37;45;53;75;95";3) will return to you combo from this array "1;12;23;35;37;45;53;75;95" taken by 3. Like 1;12;23 OR 1;12;53 and so on.

    How could I do this in Excel ?

    Any help, please ?

    Thank you so much !

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Randbetween exactly some values in excel ?

    =index({1;12;23;35;37;45;53;75;95}, randbetween(1,9))
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    06-02-2012
    Location
    Romania
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: Randbetween exactly some values in excel ?

    It return only one number. How to make it to return more than one like 1;12 or 1;23 or 35;95 and so on Or 3 of them or 4 or 5 of them ?

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Randbetween exactly some values in excel ?

    If repeats are acceptable,

    = index({1;12;23;35;37;45;53;75;95}, randbetween(1,9)) & ","
    & index({1;12;23;35;37;45;53;75;95}, randbetween(1,9))


    If not, you could list the numbers down a column, enter =rand() in the adjacent column, sort by the latter, and take as many numbers as you want from the top.

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Randbetween exactly some values in excel ?

    If not, you could list the numbers down a column, enter =rand() in the adjacent column, sort by the latter, and take as many numbers as you want from the top.
    This is how I would have done the problem from the start.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  6. #6
    Registered User
    Join Date
    02-16-2015
    Location
    Klerksdorp, South Africa
    MS-Off Ver
    Wndows 7
    Posts
    2

    Re: Randbetween exactly some values in excel ?

    I have a different struggle . I use the Randbetween formula, but I need this to stay fixed on the selected random number for each line after the first selection. This enables me to model different scenario's on the constant selected number.

    Any Help?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1