Subtracting Times in Microsoft Excel

To determine which of two values is the earliest and then Excel subtracting time  accordingly. We will use If function to create subtracting time calculator in Excel.

IF: - Check whether a condition is met and returns one value if True and another value if False.

Syntax of “IF” function =if(logical test,[value_if_true],[value_if_false])

First the formula will do the logical test, what if the output of logical test is true and false.

For example:Cell A2 and A3 contain the number 3 and 5. Ifthe number is 3, the formula should display “Yes” else “No”.

=IF (A1=3,"Yes","No")

img1

Let’s take an example to understand how we can subtract the times.

We have 2 time lists in range A1:B4 in which Column A contains Time 1 and column B contains Time 2. To find the interval between each pair of start and end time is earlier than the start time, thereby resulting in negative result.

img2

To subtract the times,follow below given steps:-

  • Write the formula in cell C2.
  • =B2-A2+IF(A2>B2,1)
  • PressEnter on your keyboard.
  • The function will return the time difference between two values.
  • Copy the same formula and paste in the range C3:C4.

img3

This is the way we can subtract the times by using the IF function in Microsoft Excel.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.