Excel Rolling Dice Tutorial

Studio shot of two dice over pink background
Bogdan Dreava / EyeEm / Getty Images

This tutorial covers how to create a dice roller in Excel that graphically displays a pair of dice on your worksheet.

The dice will display a random number generated by the RANDBETWEEN function. The dots on the die faces are created using the Wingdings font, and a combination of the ANDIF, and OR functions control when dots appear in each cell.

Depending on the random numbers generated by the RANDBETWEEN functions, dots will appear in the appropriate cells in the worksheet. The dice can be re-rolled repeatedly by recalculating the worksheet.

This tutorial is compatible with most versions of Excel including 2007, 2010, 2013, 2016, and Office 365.

Building the Dice

Adjusting the cell sizes in Excel for Android

The steps below cover the formatting techniques used to graphically display the dice on an Excel worksheet; they include changing cell size and cell alignment, as well as font type and size:

  1. Select cells D1 to J3.
  2. Select the Format button in the Home tab.
  3. Set the Row Height to 24.75 and the Column Width to 5.
  4. Set the Horizontal Cell Alignment to center and the Vertical Cell Alignment to middle.
  5. Set the Font Type to Wingdings and the Font Size to 36.
  6. Select cells D1 to F3.
  7. Set the Cell Background Color to blue.
  8. Select cells H1 to J3.
  9. Set the Cell Background Color to red.

Add the RANDBETWEEN Function

Setting the RANDBETWEEN function in Excel for Android

The RANDBETWEEN function is used to generate the random numbers shown on the dice. Follow these steps to implement the random number generator:

For the First Die

  1. Click on cell E5.
  2. Click on the Formulas tab of the ribbon menu.
  3. Choose Math & Trig from the ribbon.
  4. Click on RANDBETWEEN in the list to bring up the Formula Builder.
  5. Click on the bottom line.
  6. Type the number 1 on this line.
  7. Click on the top line.
  8. Type the number 6 on this line.
  9. Click Done.

A random number between 1 and 6 should appear in cell E5.

For the Second Die

  1. Click on cell I5.
  2. Repeat steps 2 to 9 above.

A random number between 1 and 6 should appear in cell I5.

The Functions Behind the Dots (#1)

Setting up the dice display in Excel for Android

In cells D1 and F3, type the following function:

=IF(AND(E5>=2, E5<=6),"l","")

This function tests to see if the random number in cell E5 is between 2 and 6; if so, the function places a lowercase L in cells D1 and F3. If not, it leaves the cells blank. To get the same result for the second die, type the following function into cells H1 and J3 :

=IF(AND(I5>=2, I5<=6),"l"," ")

The letter l ( lowercase L ) is a dot in the Wingdings font.

The Functions Behind the Dots (#2)

Setting up the dice display in Excel for Android

In cells D2 and F2, type the following function:

=IF(E5=6, "l", " ")

This function tests to see if the random number in cell E5 is equal to 6; if so, it places a dot in cells D2 and F2. If not, it leaves the cell blank. To get the same result for the second die, type the following function into cells H2 and J2:

=IF(I5=6,"l", " ")

The Functions Behind the Dots (#3)

Setting up the dice display in Excel for Android

In cells D3 and F1, type the following function:

=IF(AND(E5>=4, E5<=6),"l" , " ")

This function tests to see if the random number in cell E5 is between 4 and 6; if so, it places a dot in cells D3 and F1. If not, it leaves the cells blank. To get the same result for the second die, type the following function into cells H3 and J1:

=IF(AND(I5>=4, I5<=6),"l", " ")

The Functions Behind the Dots (#4)

Setting up the dice display in Excel for Android

In cell E2, type the following function:

=IF(OR(E5=1, E5=3, E5=5), "l", " ")

This function tests to see if the random number in cell E2 is equal to 1, 3, or 5; if so, it places an "l" in cell E2. If not, it leaves the cell blank. To get the same result for the second die, type the following function into cells I2:

=IF(OR(I5=1, I5=3, I5=5), "l", " ")

Rolling the Dice

Select calculate now to

To roll the dice, simply recalculate your worksheet. You can select Calculate Now under the Formulas ribbon, or you can press the F9 key in you're using a desktop version of Excel; this will cause the RANDBETWEEN functions in cells E5 and I5 to generate another random number between 1 and 6.

Hiding the RANDBETWEEN Function

Hiding the RANDBETWEEN functions in Excel for Android

Once the dice are complete and all functions have been tested to ensure they are operating correctly, the RANDBETWEEN functions in cells E5 and I5 can be hidden like so:

  1. Select cells E5 to I5.
  2. Change the font color of these cells to match the background color — In this case, change it to white.