Microsoft Office Tutorials and References

In Depth Information

**Using What Remains with the MOD Function**

You can use MOD to tell whether a number is odd or even. By simply using

a number 2 as the second argument, the returned value will be 0 if the first

argument is an even number and 1 if it is not.

But what’s so great about that? You can just look at a number and tell

whether it’s odd or even. The power of the MOD function is apparent when

testing a reference or formula, such as =MOD(D12 - G15,2). In a complex

worksheet with many formulas, you many not be able to tell when a cell will

contain an odd or even number.

Taking this a step further, the MOD function can be used to identify cells in a

worksheet that are multiples of the divisor. Figure 8
-3 shows how this works.

Figure 8-3:

Using MOD

to find

specific values.

Row 1 of the worksheet in Figure 8
-3 shows example formulas of ones that

are entered into the successive rows of Columns B and C, starting from the

second row. Column A contains numbers that will be tested with the MOD

function. If looking for multiples of 4, the MOD function will have 4 as the

divisor, and when a value is a multiple of 4, MOD returns 0. This is evident by

comparing the numbers in column A with the returned values in column B.

The same approach is used in column C, only here the divisor is 10, so

multiples of 10 are being tested for in column A. Where a 0 appears in column C,

the associated number in Column A is a multiple of 10.

In this way, the MOD function can be used to find meaningful values in a

worksheet.