Microsoft Excel: Play Dice Games With Excel

Article by Mr Excel (11,387 pts ) , published Jul 1, 2008

Problem: Your Monopoly set is missing the dice. Create a spreadsheet that will simulate randomly rolling two dice.

See all Microsoft Excel tips

Strategy: Use the RAND function and clever spreadsheet formatting to simulate two or more dice. Follow these steps.

1) Select cell A2. From the menu, select Format – Row – Height. Set the row height to 41, as shown in Fig. 300.

2) In cell B2, enter the formula =INT(RAND()*6)+1, as shown in Fig. 301.

3) With cell B1 selected, hit Ctrl+1 to open the Format Cells dialog. On the Alignment tab, change both Text Alignment fields to Center, as shown in Fig. 302.

4) On the Font tab, choose Bold and 24 point, as shown in Fig. 303.

5) On the Border tab, first choose the thick border style on the right side of the dialog, as shown in Fig. 304.

6) Next, select the Outline Preset in the top of the dialog, as shown in Fig. 305.

7) Choose OK to close the Format Cells dialog.

8) Copy cell B2 and paste it to cell D2. As shown in Fig. 306, you will have the two dice required for Monopoly.

Results: You will have one die in cell B2 and another in cell D2. Every time that you hit the F9 key, you will have a new roll of the dice.

Summary: Use the RAND function and worksheet formatting to create a dice simulation.

Commands Discussed: Format Cells

Functions Discussed: =RAND()


See all Microsoft Excel tips
                                                          

Images

Fig. 300Fig. 301Fig. 302Fig. 303Fig. 304Fig. 305Fig. 306
 
Subscribe to Home Office
RSS
Get free weekly updates, directly to your inbox.