+ Reply to Thread
Results 1 to 5 of 5

teacher in need of help.

  1. #1
    Registered User
    Join Date
    01-30-2013
    Location
    San Antono, TX
    MS-Off Ver
    Excel 2010
    Posts
    2

    teacher in need of help.

    Ok, this may be an odd request.

    I want to input a number in CELL A1 ranging from 20 -100

    Then I am trying to get 20 CELLS below that to automatically and randomly input numbers 1 through 5 that equal to the number I put in CELL A1.

    Anyone know how I can do this?

    My only programming experience stems from early 90's Q basic, and a Pascal class I took in high school. LOL

    I am learning VBA but need help with this specific code for my wife.

  2. #2
    Forum Contributor
    Join Date
    02-24-2011
    Location
    Belfast, N. Ireland
    MS-Off Ver
    Excel 2010
    Posts
    103

    Re: teacher in need of help.

    Tonysix00,

    Could you provide an example?

    Do you want a selection of random numbers, between the value of 1 and 5, that will give a total equal to your user input from Cell A1? I am not sure how random this would be as true randomness could not be set to a total figure and if you need the full 20 cells filled then that removes even more randomness

    Mowgli

  3. #3
    Registered User
    Join Date
    01-30-2013
    Location
    San Antono, TX
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: teacher in need of help.

    Yes I need all cells filled between 1-5 ... would that not be able to do as random?
    Last edited by tonysix00; 01-30-2013 at 01:06 PM.

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: teacher in need of help.

    There are a couple of issues with your premise. Say for example you enter 20 into A1. Then by default all the following cells will have to have a value of 1 in them. Not much randomness there.

    On the other extreme lets say we do create a random number generator wich generates a number between 1 and 5 in A2 through A21. What if you put 100 in A1 and the first number generated in A2 is 1. There is no possible way to fill the next 19 rows which would allow the total to be equal to 100.

    Now we could probably build a code to randomly generate the numbers then check the summation of them to the value in A1 and keep adjusting values until we get there but that just sounds like a ton of work.

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: teacher in need of help.

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.


+ 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.6.0 RC 1