Solved

# Generate a range of integer random numbers

Posted on 2013-02-05
342 Views
What formula or combination of formulas can I insert into a large Excel table in order to generate a random integer number for each cell in the range of 65 to 122?  Duplicates expected.

(Using Excel 2003 where x = the number of cols and y = the number of rows)

0
Question by:WaterStreet
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• Learn & ask questions

LVL 50

Expert Comment

ID: 38854239
Hello,

something along the lines of

=INT(RAND()*(122-65)+65)

cheers, teylyn
0

LVL 7

Accepted Solution

leptonka earned 275 total points
ID: 38854251
Hi,

I think to have the correct intervall (including 65 and 122) you should add +1:
=INT(RAND()*(122-65+1)+65)

Cheers,
Kris
0

LVL 50

Assisted Solution

Ingeborg Hawighorst (Microsoft MVP / EE MVE) earned 175 total points
ID: 38854261
You're right, Kris. My suggestion will never hit 122, it will always be below.
0

LVL 24

Assisted Solution

Steve earned 50 total points
ID: 38854481
Can you not just use RANDBETWEEN

=RANDBETWEEN(65,122)

If this function is not available, and returns the #NAME? error, install and load the Analysis ToolPak add-in.
0

LVL 50

Expert Comment

ID: 38854493
... just in case the Analysis ToolPak is not available. For e.g. in my employer's network install it isn't.
0

LVL 92

Expert Comment

ID: 38854746
No points, please :)

For Excel 2007+ users, RANDBETWEEN no longer requires the Analysis ToolPak.

I know this does not help WaterStreet right now...
0

LVL 18

Author Closing Comment

ID: 38857259
Wow!  Thanks everyone.

I'd be embarrassed to say how many hours I wasted trying to figure this out, until I got too tired and then remembered EE.

I have another question that is really the second half of my project's problem.  Don't answer it here, because I will post it as a new question in this Zone.

If you're interested then think about how I would use the Accepted Solution to generate a table of integer random numbers in the specified range, like here, but where there are (let's say 3) Sub Ranges within -- that each have a specified weight/bias (Bias) for appearing in the table.

I'll try to notify you here when I ask the new question.

Thanks
0

LVL 18

Author Comment

ID: 38857856
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
###### Suggested Courses
Course of the Month3 days, 6 hours left to enroll

#### 691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.