The MOD function returns the rest of a division. This function is very useful for

- a logical test
- the conditional formatting
- data validation

Table of Contents

## Presentation of the MOD function

If you divide 12 by 3, the result is 4.

The result is a whole number, so the rest of the division is obviously 0. And this is what the function MOD returns

=MOD(12,3) =>0

Now if we divide 12 by 5, the result of the division is not an integer.

The rest of the division, or the modulo, will give this result

=MOD(12,5) =>2

## Odd or even?

The function MOD is the most convenient way to find if a number is odd or even. The test to write is very simple.

### Even number

=MOD(A2,2)=0

### Odd number

=MOD(A2,2)<>0

And you can include this test in an IF function to display the result of your test

=IF(MOD(A2,2)=0,"Is even number", "Is odd number")

## Other examples of use of the MOD function

You can also used the MOD function is these cases

- Test if the maturity of a contract is reached or not (divisor = 12)
- Quantity in a package (divisor depends of the number of items)

## QUOTIENT function

If you want to return the opposite, the integer part of a division, in that case you have to use the QUOTIENT function.

=QUOTIENT(15,2) =>7

In fact, it's exactly like doing the division inside a INT function

=INT(15/2) =>7

## GCD function

The GCD function returns the Greatest Common Divisor 🤨🤔🙄

This function returns the greatest value that divide 2 values. For example, if you have the value 120 and 48, the result is:

=GCD(120,48) => 24

Because

**24*** 2 = 48**24*** 5 = 120

## 1 comment

Hi ,Could you please advise if it is possible to reference a date with a value to be repeated by frequency,( ie 7 days, 30, 90 days,180 days) from that date using Mod & IF syntax nested

Thanks

Brad