Power Automate Mod Function Explained

The Power Automate Mod function, also known as the modulo operator, returns the remainder of dividing the dividend by the divisor.

In other words, mod(dividend, divisor) = dividend % divisor. For example, mod(5, 2) would return 1, because 5 divided by 2 is 2 with a remainder of 1.

In this article, Iâ€™ll introduce you to the mod function and will provide a step-by-step guide on how to use the function in a Microsoft flow.

Power Automate Mod Function

To find the remainder when dividing two numbers, use the mod function. To obtain the integer quotient, use the div() function.

Syntax

``mod(<dividend>, <divisor>)``

Input parameters

• dividend (mandatory): The number that will be divided by the divisor.
• divisor (mandatory): The number that will divide the dividend, but must not be zero.

Return value

• Returns the remainder after dividing the first number by the second number.

Power Automate Mod Expression Examples

``````mod(8,3)
=> 2

mod(9,3)
=> 0

// float example
mod(5.5,1.5)
=> 1

// with variable
mod(variables(â€˜myNumberâ€™), 3)``````

How To Use The Power Automate Mod Function

Follow the steps to use the Power Automate Mod function in a flow.

New flow

4. Setup Initialize variable: 1) Provide a name, 2) select type Integer, 3) Set value to â€˜8â€™

Setup variable