#1
|
|||
|
|||
Generating random number of integers in a specific manner
Hello everyone,
Hope you can help me to the this using MSExcel 2007, (no RANDARRAY() function) ---------- Input cells: A1 = any positive integer. B1 = any nonnegative integer (but less than A1). C1 = any positive integer that is greater than or equal to B1 (but less than A1). Output cells: A2, A3, A4, ..., contain the numbers 1, 2, 3, ..., (in order), until we reach the value of A1. B2, C2, D2, ..., contain distinct random integers satisfying 4 properties: * the number of columns must be a random integer between B1 and C1 (inclusively), * each of these random integers must lie between 1 and A1 (inclusively), * these numbers must be in ascending order, * and none of these is equal to the value of A2. Similarity for B3, C3, D3, ... Similarity for B4, C4, D4, ... and so on, until we reach to the last row in column A. ---------- Your help would be appreciated. Thanks. |
#2
|
||||
|
||||
In the attached, a single celled user defined function used thus:
2022-10-16_171134.png Edit:Sorry, just noticed Quote:
Last edited by p45cal; 10-16-2022 at 02:47 PM. |
#3
|
||||
|
||||
This should work for Excel 2007 but can't test.
To enter the formula, first select a range having a row count of the value in A1 and a column count of the value in C1 + 1, then enter RandNos(A1,B1,C1) then while holding both the Ctrl and Shift keys, press Enter to array-enter that formula in the whole range at once. Of course the range size needs to change according to what's in A1 and C1, which can be irritating. If you want, we could create a macro which would put the values in the cells instead of using a formula? |
Tags |
excel 2007, rand, random |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Copy Random Generated Number to new Sheet | farhadj | Excel Programming | 2 | 06-02-2019 11:28 PM |
How to insert random numbers that equal a certain number | baha | Excel | 16 | 11-24-2014 10:50 AM |
Endnotes Generating Random Sections for Each Page | Kim Korn | Word | 7 | 08-13-2014 09:51 PM |
Random number difficulties | ahrinn | Word | 12 | 08-01-2012 01:04 PM |
generating a number in Word | John P | Word | 1 | 05-31-2012 10:29 PM |