# How to Calculate a Time Difference in Google Sheets

To calculate a time difference in Google Sheets, you can use the formula `=EndTime - StartTime`

. You should format the cells containing time data in the appropriate time format before performing the calculation. Here's a step-by-step guide:

- Open your Google Sheet.
- Enter your start time in cell A1 and end time in cell B1. For example, if the start time is 8:00 AM and the end time is 5:00 PM, enter
`8:00 AM`

in A1 and`5:00 PM`

in B1. - Click on cell A1 and then click on the
`Format`

menu, select`Number`

, and choose the time format you want (e.g.,`1:30 PM`

). - Do the same for cell B1.
- In cell C1, enter the formula
`=B1 - A1`

to calculate the time difference. - Press
`Enter`

. - Format cell C1 as a duration by clicking on the cell, then going to the
`Format`

menu, selecting`Number`

, and choosing`Duration`

.

## Example

Here's an example of how to calculate a time difference in Google Sheets:

- Start Time (A1):
`8:00 AM`

- End Time (B1):
`5:00 PM`

- Format cells A1 and B1 with the time format.
- In cell C1, enter the formula:
`=B1 - A1`

- Press
`Enter`

. - Format cell C1 as a duration.

The result in cell C1 should display the time difference as `9:00:00`

, indicating a difference of 9 hours between the start and end times.

Did you find this useful?