Random Question Generator

Joda

New Member
Joined
May 20, 2010
Messages
2
Hi, after a bit of help, what i am trying to do is design a random question generator for somethign i am doing at work, has to be done within access or excel. This is what i am trying to achieve..

100 Questions, broken down into 5 categories. and it will lets say choose 2 random questions from each section, to make a small exam.

Anyone available to help as have been scratching my head, have workd out how to create a whole random number, and also messed about with LOOKUP and VLOOKUP but cant seem to get that working properly, let alone figured out how to ensure it doesnt pick the same question twice in the same run.

anyone help :x


thanking you in advance
 

antoka05

New Member
Joined
May 7, 2010
Messages
18
To generate a random number you can use this function:
=Int(Rand() * (<max number> - <min number> + 1)) + <min number>
where <min number> and <max number> are min and max value

Then, to get data from a random row, you can use =index(matrix, row, column).
Regards,

Antonio
 

jbeaucaire

Well-known Member
Joined
May 8, 2002
Messages
6,012
Check out this file on my site:


I added a second sheet showing how the technique can be used to grab 2 items from each section. There can be no duplicates in any one test.
 

Misca

Well-known Member
Joined
Aug 12, 2009
Messages
1,528
Not sure if you want this to be done with a normal function or by a macro but these links should answer your first question:

http://www.ozgrid.com/Excel/excel-random-pick.htm (= Excel)
http://www.techonthenet.com/excel/formulas/rnd.php (= VBA)

Making sure the random numbers are not the same is quite easy in VBA but how to make sure it won't happen in Excel is a bit trickier. I'd try to solve it with by placing the "normal" RANDBETWEEN function in the first cell and then putting the same function twice in an IF function for the second cell (The logic being "if the functions return same values then try again").

I tried this with

=IF(RANDBETWEEN(1,2)=A1,RANDBETWEEN(1,2),RANDBETWEEN(1,2))

several times and never got the same values so it seems to work.
 

Forum statistics

Threads
1,077,635
Messages
5,335,379
Members
399,014
Latest member
hamzalaarif

Some videos you may like

This Week's Hot Topics

Top