Home > Topics > Excel > body text

What does the mod() function mean?

藏色散人
Release: 2020-02-27 10:34:54
Original
16308 people have browsed it

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]
Copy after login

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
Copy after login

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!

Related labels:
mod
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!