+ Reply to Thread
Results 1 to 5 of 5

Thread: Random Number Range from Variable Value

  1. #1
    Registered User
    Join Date
    11-22-2011
    Location
    Edinburgh
    MS-Off Ver
    Excel 2003
    Posts
    13

    Random Number Range from Variable Value

    Hi,

    I am trying to return a different random number range based on a variable value. I would have used the IF function but that is limited to 7 arguments.

    Here are the ranges I plan to use. I am not worried if the random number is duplicated as I plan to use decimals.

    Group Range
    Group 01 1 - 50
    Group 02 51 - 100
    Group 03 101 - 150
    Group 04 151 - 200
    Group 05 201 - 250
    Group 06 251 - 300
    Group 07 301 - 350
    Group 08 351 - 400
    Group 09 401 - 450
    Group 10 451 - 500
    Group 11 501 - 550
    Group 12 551 - 600
    Group 13 601 - 650
    Group 14 651 - 700
    Group 15 701 - 750
    Group 16 751 - 800
    Group 17 801 - 850
    Group 18 850 - 900

    Hope this makes sense and someone can help.
    Last edited by cfherd; 11-23-2011 at 04:38 AM.

  2. #2
    Forum Guru Domski's Avatar
    Join Date
    12-14-2009
    MS-Off Ver
    What does it matter?
    Posts
    3,933

    Re: Random Number Range from Variable Value

    Hi,

    Maybe something like the attached.

    Dom
    Attached Files Attached Files
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Valued Forum Contributor Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens Greece
    MS-Off Ver
    Excel 2003
    Posts
    2,297

    Re: Random Number Range from Variable Value

    Ηι

    You can use what "if" you want, using the symbol +.

    Another solution is to use INDEX&MATCH.
    Attached Files Attached Files
    Regards

    Fotis.

    I am proud that i am Greek.

    Just to know every one.We Greeks, we are nοt proud of our politicians. Υou?

    Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.


    My Avadar picture, is from Athens Acropolis.
    http://www.theacropolismuseum.gr

    http://www.visitgreece.gr/

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    MS 2007
    Posts
    5,372

    Re: Random Number Range from Variable Value

    Lets' say your group # is in A2 in the form of "Group 02" (it would help if you uploaded an example workbook)

    =IF(ISTEXT(A2),RANDBETWEEN(MID(A2,6,5)*50-49,MID(A2,6,5)*50),"")

    If you just have the group # as a number, that simplifies to
    =IF(ISNUMBER(A2),RANDBETWEEN(A2*50-49,A2*50),"")
    ChemistB
    My 2¢

    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

  5. #5
    Registered User
    Join Date
    11-22-2011
    Location
    Edinburgh
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Random Number Range from Variable Value

    Thanks for the reply folks, didn't realise that I would get such a quick response. Fortunatly the first answer worked like a charm! Thanks again. Chris.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0