# MathsClass

A blog about teaching and learning in a maths classroom.

## Making a dice

Sunday, 27 September 2009 | 2 Comments

In my IST class, we’re studying Modeling and Simulation, and started to make a model of a dice using Excel.

Thinking about it, the technique involved in making this would also be of interest to Maths teachers.

#### 1. Analysis Toolpak

In Excel, make sure the Analysis Toolpak is installed.

#### 2. Understand the RANDBETWEEN function

The RANDBETWEEN function will return an integer between the bottom and top numbers everytime the worksheet is recalculated (by pressing F9 on Windows and Command + = on a Mac).

So, for a six sided dice, you’d want this formula in a cell:

=RANDBETWEEN(1,6)

But, we could make this more flexible. For starters, using references to other cells will allow the size of the dice to be changed easily.

A B
1 Bottom: 1
2 Top: 6
3 Roll: =RANDBETWEEN

#### 4. Make it look nice

Making the number look nice is one thing, but a nice touch is to use dots.

A B C D E
1 Bottom: 1
2 Top: 6
3 Roll: 5
4
5
6
7

Formulas:

C5

=IF($B$3&lt;&gt;1,&quot;&bull;&quot;,&quot;&quot;)

C6

=IF($B$3=6,&quot;&bull;&quot;,&quot;&quot;)

C7

=IF($B$3&gt;=4,&quot;&bull;&quot;,&quot;&quot;)

D6

=IF(ISODD($B$3),&quot;&bull;&quot;,&quot;&quot;)

E5
=IF($B$3&gt;=4,&quot;&bull;&quot;,&quot;&quot;)
E6
=IF($B$3&gt;=4,&quot;&bull;&quot;,&quot;&quot;)
E7
=IF($B$3&gt;=2,&quot;&bull;&quot;,&quot;&quot;)

To make the dots appear, you need to set the font for those cells to Wingdings and insert the bullet symbol into the formulas.

Watch it in action:

#### 5. Extensions

• Change the variables from bottom/top to starting number and number of sides.

See my earlier post Dice for a version with these extensions.

6 sided dice XLS, 20 KB

Posted in • How toSoftwareExcel | Short URL: http://mths.co/1661

• Share:

eneyland on  29 September 09  at  03:38 AM #
Thanks this is quite nifty!
Luke Molan on  29 September 09  at  05:23 AM #
Nice use of excel in maths. As an extension you could get students to play with the code to rig the dice. Could be some fun with probability.

Commenting is not available in this channel entry.

New  Subscribe to the …

Simon Job — eleventh year of teaching maths in a public high school in Western Sydney, Australia.
MathsClass is about teaching and learning in a maths classroom. more→

@simonjob