# Digital Rain

Description

This app simulates the Digital Rain Effect made popular by the movie Matrix.

.xls file (55 KB) .zip (11 KB)

## How to use

Use the scrollbar to create the Digital Rain effect.

## How it works

There are 3 components that create the effect.

The first is the cell A1, which acts as a counter, and is controlled by the user through the scroll bar. The other cells refer to the number in this cell to decide whether the cell will have its font in white, bright green, dark green or black.

The next are the formulae in the cells. Except those in the first row, the other cells have the formula =INT(RAND()*10). This formula generates random numbers between 0 and 9. (Note that the formula =RANDBETWEEN(0,9) can also be used, however, this formula does not exist in older versions of Excel).
Whenever the number in the counter changes, the formula is recalculated, which makes all the numbers on the sheet, except those in the first row, change continuously. The first row also contains random numbers between 0 and 9 but they do not change. These numbers are used in the conditional format formulae to stagger the rain drops, otherwise, all drops will fall in parallel.

Finally and most importantly, are the conditional formatting formuale. The purpose of these formulae is to decide the colour of the number in the cell. Depending on the number in the counter, the font can be either white, bright green, green or black. This creates the effect of the falling numbers.

The drops fall at intervals of 15 cells. There is a gap of 15 cells between one white cell and the next one in the same column. The conditional formatting uses the MOD formula (=MOD(\$A\$1,15)) to cyclically generate numbers from 0 to 15. The MOD formula returns the remainder when the number in A1 is divided by 15. For example, if A1=17, MOD(17,15) returns the number 2, which is the remainder when 17 is divided by 15. If the number is an integer multiple of 15 (like 30), the formula returns 0.

The other formula used is the ROW() formula which returns the row number of the cell.

Lets now look at the conditional formatting formulae for cell B1.

The formula for the first condition first condition is =MOD(\$A\$1,15)=MOD(ROW()+B\$1,15). This makes the row numbers that satisfy the condition show the numbers in them in white font. For simplicity, let us assume that the number in the cell B1=0. Then, the formula for B1 works out to
=MOD(\$A\$1,15) = MOD(1+0,15) = MOD(1,15) = 1 or
=MOD(\$A\$1) = 1

This the font in the cell B1 will be white whenever the value of the counter is one more than a multiple of 15, that is 1, 16, 31,etc.

The second condition in the conditonal formatting sets the font of the cell behind the white number to bright green. If cell B1 shows white font when when the counter is 16, the second condition will set it to a bright green font when the counter value changes to 17. This is easily done by adding 1 to the MOD formula on the right hand side of the equation.

=MOD(\$A\$1,15)=MOD(ROW()+B\$1+1,15)

Similarily, the last condition creates a dark green "tail" of 4 cells that follow the bright green cell. These are achieved by adding a number to ROW()+B\$1 on the right side. For instance, using ROW()+\$B1+2 will be the second cell behind the white cell. The OR operator is used to capture the 4 cells behind the bright green cell.

If none of these conditions are satisfied, the cell will have the font in the default colour black, and the number will be invisible.

Note that we have used \$A\$1 on the right side while B\$1 on the left. This is because using \$A\$1 will make the function look at the cell A1 at all times, while the B\$1 will look at the cell in B1 as long as the cells are in column B, when the cell is copied to column C, it will look at C1. As the cells in the first row have fixed random numbers, this creates a "phase difference" between the drops in adjacent columns.

## Digital Rain featured on Microsoft's 'Office Show'

The Digital Rain Tool has been featured in an episode of 'The Office Show' produced by Microsoft, see video below from 08:40 to 09:40.

## Also See:

Animation without Charts

Animated Charts

Parametric Function Plotter