Home >Topics >excel >What does the mod() function mean?

What does the mod() function mean?

藏色散人
藏色散人Original
2020-02-27 10:34:5416651browse

What does the mod() function mean?

What does the mod() function mean?

The mod function is a remainder function, its format is: mod(nExp1,nExp2), which is the remainder after dividing two numerical expressions. Special note: In EXCEL, the MOD function is used to return the remainder of the division of two numbers. The sign of the returned result is the same as the sign of the divisor.

mod expression

The mod function is a remainder function, its format is: mod(nExp1,nExp2), which is the remainder after dividing two numerical expressions. Then: finding the remainder of two integers with the same sign is exactly the same as finding the remainder of two positive numbers that you know (that is, the algorithm for two negative integers is the same as that of two positive integers).

Syntax: MOD(number,divisor)

Parameters:

Number is the dividend.

Divisor is the divisor.

In Oracle, if divisor is 0, the function returns number directly.

Explanation:

Function MOD can be expressed by borrowing the function INT:

MOD(n, d) = n - d*INT(n/d) [3]

Example:

MOD(3, 2) 等于 1
MOD(-3, 2) 等于1
MOD(3, -2) 等于-1
MOD(-3, -2) 等于-1
MOD(-3, 0) 等于-3
MOD(3, 0) 等于3
MOD(2, 0) 等于2
MOD(4, 3) 等于1

In Excel, the divisor cannot be 0, otherwise An error will be reported.
MOD(3, -2) is equal to -1 (the same sign as the following number)
MOD(3, 0) reports an error and the output result is #DIV/0!

The above is the detailed content of What does the mod() function mean?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn