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)


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
2Top:6
3Roll:=RANDBETWEEN

4. Make it look nice

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

                                                                                                                               
ABCDE
1Bottom:1   
2Top:6   
3Roll: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.

6 sided dice XLS, 20 KB
This work is licensed under a Creative Commons License (?).

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

Comments

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.

Post a comment

Commenting is not available in this channel entry.

New  Subscribe to the …

MathsLinks
email newsletter

Get updates…



Twitter   Facebook   Pinterest

About

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→

Archive

by date

by category

Search

Elsewhere

@simonjob
updates via @mathslinks

Recently read/found.

View All | RSS