spot_img

What is Mod Function in Excel

In Excel, the MOD function is a built-in function. MOD function is categorized as a Math/Trig Function. In Excel, it can be utilized as a worksheet function (WS). Like the worksheet function, the MOD function can be entered as part of a formula in a worksheet cell.

The MOD function in Excel is used to calculate the remainder after the division of one number by another (divisor). This operation is known as modulo operation or modulus in mathematics, hence the name MOD.

Syntax

The following is the syntax of the MOD function:

Arguments or Parameters

The following are the arguments of the MOD function:

  1. number
  2. divisor

number

A number for which we need to find the remainder.

Divisor

It is a number by which we want to divide number.

Important Things which We have to Know About MOD Function in Excel

The following are the important things which we have to know about the MOD function in Excel:

  1. The MOD function’s result has the same sign as the divisor.
  2. The MOD function returns #DIV/0! Error, if the divisor is 0 because we cannot divide by zero.
  3. The MOD function returns #VALUE! Error if the number or divisor is a text value.

How to Use MOD Function in Excel?

The MOD function is really easy to use. Let’s have a look at some examples of how to utilize the MOD function in Excel.

Example 1: Consider the numbers n=4 and d=3. Use the MOD function:

What is Mod Function in Excel

After applying the formula, the result will be:

What is Mod Function in Excel

The MOD function returns 1 because 2 goes into 5 once with a remainder of 1.

Example 2: In this example, we have to get the remainder from the division.

What is Mod Function in Excel

We will apply the MOD function.

What is Mod Function in Excel

After applying the MOD function, the result will be:

What is Mod Function in Excel

Now, in order to get the result of the remaining values, we will drag and drop the formula and will get the below result:

What is Mod Function in Excel

Example 3: Add only the even numbers in the given dataset:

In this example, we have to add only the even numbers in the dataset using the mod function.

What is Mod Function in Excel

We will use the below formula in order to add even values in the above-given dataset:

What is Mod Function in Excel

In even number case, (MOD($A$2:$A$10,2)=0) returns an array of TRUE, the SUMPRODUCT function adds just those numbers which Returns TRUE.

After applying the formula, the result will be:

What is Mod Function in Excel

Example 4: Add Only the Odd Numbers in the Given Dataset:

In this example, we have to add only the odd numbers in the dataset using the mod function.

What is Mod Function in Excel

We have to use the below formula in order to add the odd number in the above-given dataset.

What is Mod Function in Excel

In the odd number case, (MOD($A$2:$A$A10,2)=1) returns an array of TRUE, the SUMPRODUCT function adds only those numbers that return TRUE.

What is Mod Function in Excel

As a result, this formula works by calculating the remainder using the MOD function.


spot_img
Previous articleSunbrust Chart in Excel
Next articleBold, Italic and Underline Command in MS Word