A blog about teaching and learning in a maths classroom.

Making a dice

Monday, 28 September 2009

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(bottom,top) 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)

3. Adding flexibility

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(B1,B2)

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<>1,"•","")
C6
=IF($B$3=6,"•","")
C7
=IF($B$3>=4,"•","")
D6
=IF(ISODD($B$3),"•","")
E5
=IF($B$3>=4,"•","")
E6
=IF($B$3>=4,"•","")
E7
=IF($B$3>=2,"•","")

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

Dice with dots in Excel

Watch it in action:

5. Extensions

  • Add sliders to adjust the bottom and top numbers.
  • Change the variables from bottom/top to starting number and number of sides.
  • Add a second dice.

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

Download: 6 sided dice (XLS 20 KB)

This work is licensed under a Creative Commons License (?).
Posted in • How toSoftwareExcel
Save link to Delicious · diigo · pinboard · twitter | Shorturl:
Next entry: Link: Western Bulldogs Number Plane Logo Previous entry: NSWDER Tutorials

Related entries…

Comments

Gravatar for eneylandeneyland on  29 September 09  at  02:38 PM #

Thanks this is quite nifty!

Gravatar for Luke MolanLuke Molan on  29 September 09  at  04:23 PM #

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.

Post a comment

Commenting is not available in this channel entry.

Social Media Icons from IconDock. Website thumbnails provided by BitPixels.

The posts and comments I make on this blog are made in a private capacity and do not represent the official view of my employer.