Dapatkan sisanya dari pembagian
=MOD(number, divisor)
| Parameter | Deskripsi |
|---|---|
number |
The number to be divided. |
divisor |
The number to divide with. |
The result from the MOD function is calculated with an equation like this:
=n-d*INT(n/d)
where n is number, d is divisor, and INT is the INT function. This can create some unexpected results because of the way that the INT function rounds
=MOD(7,3) // returns 1
=MOD(7,-3) // returns -2
Below are some examples of the MOD function with hardcoded values:
=MOD(12,3) // returns 0
=MOD(12,5) // returns 2
=MOD(100,33) // returns 1
=MOD(6.25,1) // returns 0.25
The result from MOD carries the same sign as divisor. If divisor is positive, the result from MOD is positive, if divisor is negative, the result from
=MOD(-3,2) // returns 1
=MOD(3,-2) // returns -1
=MOD(-3,-2) // returns -1
The MOD function can be used to extract the time value from an Excel date that includes time (sometimes called a datetime). With a datetime in A1, the
=MOD(A1,1) // return time only
With very large numbers, you may see the MOD function return a #NUM error. In that case, you can try an alternative version based on the INT function:
=number-(INT(number/divisor)*divisor)