+ Reply to Thread
Results 1 to 7 of 7

Randbetween to take numbers based on the cell values

  1. #1
    Registered User
    Join Date
    10-29-2013
    Location
    Bangalore
    MS-Off Ver
    Excel 2010
    Posts
    17

    Randbetween to take numbers based on the cell values

    Hi All,

    I want to Randbetween formula for Ratings. Here i have taken number from 1 to 4.

    I want to restrict the Randbetween formula to use "1 for 15 times", "2 for 20 times", "3 for 25 times" and "4 for 40 times" as per the cell value in the attached file. Kindly let me know how can i do this?

    I have attached the excel file for your reference.

    Regards,
    Harish
    Attached Files Attached Files
    Last edited by harish.chinni; 11-12-2013 at 03:15 AM.

  2. #2
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: Randbetween to take numbers based on the cell values

    I don't really understand what you want. Here's my guess:

    A1:A100 = range of employee numbers
    B1:B100 = corresponding rating for each employee number, A - D

    E2:H2 = {"A", "B", "C", "D"}

    E3 = COUNTIF($B$1:$B$100, "="&E2)
    then pulled across for F3:H3

    E4 = RANDBETWEEN(1, MATCH(E3, {15, 20, 25, 40}, 1) )
    then pulled across for F4:H4

    Of course, I have no idea whether you want that array to be a floor or a ceiling (this treats it as a floor) or what.

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Randbetween to take numbers based on the cell values

    you could try this uses rand() and small()
    slight amendment if by some chance rand() produces duplicate numbers
    so there are say 16 values <= say small 15

    then cells will highlight just recalculate with f9
    Attached Files Attached Files
    Last edited by martindwilson; 11-11-2013 at 10:23 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Randbetween to take numbers based on the cell values

    Hi there,

    It's interesting how many interpretations can be put on a query

    On reading your query,my initial reaction was that you wanted a random number between 1 and 4 generated 15 times, a random number between 2 and 4 generated 20 times, a random number between 3 and 4 generated 25 times - not sure why you'd want a random number between 4 and 4 generated 40 times, but who knows????

    Anyway, going with my initial reaction, enter the following formula into Cell B2 and copy it downwards:

    Please Login or Register  to view this content.

    Please let me know how much I've misinterpreted your query!

    Regards,

    Greg M

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Randbetween to take numbers based on the cell values

    Someone posted this same homework assignement a few years ago:

    http://www.excelforum.com/excel-form...quirement.html
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Randbetween to take numbers based on the cell values

    interesting some people do try it on and both from the same city
    but i think my answer gives one less column!
    Last edited by martindwilson; 11-11-2013 at 09:08 PM.

  7. #7
    Registered User
    Join Date
    10-29-2013
    Location
    Bangalore
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Randbetween to take numbers based on the cell values

    Thanks for sharing the link, I got the answer from link provided.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Randbetween excluding certain letters/numbers
    By Wheelie686 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-13-2018, 03:58 PM
  2. Loop based on two values and then Copy based on numbers between the two values
    By mintsaucesheep in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-20-2013, 09:43 AM
  3. How to exclude numbers from RANDBETWEEN function?
    By mathteacher in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-01-2013, 04:50 PM
  4. Replies: 8
    Last Post: 09-21-2011, 06:50 PM
  5. Random numbers not using randbetween()
    By davehill1974 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-07-2005, 12:05 PM

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