Calculate the difference between two times
Let's say 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 (hours : minutes : seconds)
Present the result in a total based on one time unit (120 minutes)
Present the result in the standard time format (hours : minutes : seconds )
There are two approaches that you can take to present the results in the standard time format. You can use the subtraction operator (-) to find the difference between times and:
- A custom format code in the cell.
- 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 to copy an example
- Create a blank workbook or worksheet.
- Select the example in the Help topic.
Note Do not select the row or column headers.
Selecting an example from Help
- Press CTRL+C.
- 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
Formulastab, in theFormula Auditinggroup, click theShow Formulasbutton.
|
|
The previous example shows two ways to calculate the difference between two times. You can use:
- A simple subtraction formula and the result formatted with a custom code. Select the cell, and on the
Hometab, in theNumbergroup, click the arrow next to theNumber Formatbox, clickMore Number Formats, clickCustomin theCategorylist, and then click a custom format in theTypebox. - The TEXT function which has a formatting argument.
Note If you use both a format applied with the TEXT function and number format, the TEXT function takes precedence.
Function and format details
Display numbers as dates or times
Present the result in a total based on one time unit (120 minutes)
To do this task, use the INT function, or HOUR, MINUTE, and SECOND functions.
Example
The example may be easier to understand if you copy it to a blank worksheet.
How to copy an example
- Create a blank workbook or worksheet.
- Select the example in the Help topic.
Note Do not select the row or column headers.
Selecting an example from Help
- Press CTRL+C.
- 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
Formulastab, in theFormula Auditinggroup, click theShow Formulasbutton.
|
|
Function details
![]()