Calculate the difference between two times
Let's say that you want find out how long it takes for an employee to complete an assembly line operation or a fast food order to be processed at peak hours. There are several ways to calculate the difference between two times.
What do you want to do?
Present the result in the standard time format
There are two approaches that you can take to present the results in the standard time format (hours : minutes : seconds). You use the subtraction operator () to find the difference between times, and then do one of the following:

Apply a custom format code to the cell by doing the following:

Select the cell.

On the Home tab, in the Number group, click the arrow next to the Number Format box, and then click More Number Formats.

Click Custom in the Category list, and then select a custom format in the Type box.


Use the TEXT function to format the times.
When you use the time format codes, hours never exceed 24, minutes never exceed 60, and seconds never exceed 60.
Example
The example may be easier to understand if you copy it to a blank worksheet.
How do I copy an example?

Select the example in this article.
Selecting an example from Help

Press CTRL+C.

In Excel, create a blank workbook or worksheet.

In the worksheet, select cell A1, and press CTRL+V.

To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
After you copy the example to a blank worksheet, you can adapt it to suit your needs.


For more information about how to use these functions, see TEXT function and Display numbers as dates or times.
Present the result based on a single time unit
To do this task, use the INT function, or the HOUR, MINUTE, and SECOND functions as shown in the following example.
Example
The example may be easier to understand if you copy it to a blank worksheet.
How do I copy an example?

Select the example in this article.
Selecting an example from Help

Press CTRL+C.

In Excel, create a blank workbook or worksheet.

In the worksheet, select cell A1, and press CTRL+V.

To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.
After you copy the example to a blank worksheet, you can adapt it to suit your needs.


For more information about how to use these functions, see INT function, HOUR function, MINUTE function, and SECOND function.