In this article, we will learn how to avoid errors when subtracting times in Microsoft Excel.
While calculating the difference between two time values, the former time must be subtracted from the latter one to avoid any error.
However, when the latter time refers to the following day (with respect to the earlier time), an error will occur.
We want to create a formula that avoids these errors when calculating the difference between any two time values.
We will use MOD function to get the output.
MOD: Returns the remainder after a number is divided by a divisor.
number: It is a numeric value whose remainder you want to find.
divisor: It is the number which is used to divide the number argument.
Example of Mod Function:
Let us take an example:
- We have time in column A & B
- We want to find their difference
- We will enter the formula in cell C2=MOD(B2-A2,1)
- Copying the formula down in below range of cells, we will get the desired result