To find the duration of time in Excel, subtract the start time from the end time using a basic formula (=End_Time - Start_Time) and then apply a specific time format to the result cell. Because Excel treats one whole day as the number 1, subtracting two times provides a decimal fraction of a day, which must be formatted as "Time" or a custom duration code to be readable.

What You'll Need

  • Microsoft Excel (Desktop, Web, or Mobile version)
  • A dataset containing at least two columns: a Start Time and an End Time
  • Times entered in a recognized format (e.g., 9:00 AM or 14:00)

Step-by-Step

  1. Enter Your Data: Place your start times in one column (e.g., Column A) and your end times in another (e.g., Column B). Ensure you include AM/PM or use 24-hour military time so Excel recognizes the entries as time values rather than text.
  2. Insert the Subtraction Formula: Click on the cell where you want the duration to appear (e.g., cell C2). Type the equals sign, click the end time cell, type a minus sign, and click the start time cell. The formula should look like this: =B2-A2. Press Enter.
  3. Apply Basic Time Formatting: If the result looks like a decimal (e.g., 0.333), you need to change the cell format. Right-click the result cell and select Format Cells. In the Number tab, select Time from the Category list and choose a format like "13:30".
  4. Handle Durations Over 24 Hours: If your time duration exceeds 24 hours, Excel's default time format will "reset" to zero (for example, 25 hours will appear as 1 hour). To fix this:
    • Right-click the cell and select Format Cells.
    • Go to the Number tab and select Custom.
    • In the "Type" box, manually type [h]:mm. The square brackets tell Excel to accumulate hours rather than resetting at the 24-hour mark.
  5. Convert Duration to Decimals (Optional): If you need the duration as a decimal number (e.g., 8.5 hours instead of 8:30) for payroll or multiplication, use this formula: =(B2-A2)*24. Then, format that cell as a Number or General instead of Time.

Common Mistakes

  • Incorrect Data Entry: Entering times as "9am" (without a space) or "9 o'clock" often causes Excel to treat the cell as text. If the cell is aligned to the left, Excel thinks it is text; if it is aligned to the right, it is a number/time.
  • Negative Time Results: If the start time is after the end time (e.g., a shift that starts at 10 PM and ends at 6 AM), Excel will display a series of hashtags (#######) because it cannot show negative time by default.
  • Forgetting the Brackets: Using h:mm instead of [h]:mm when calculating total project hours. This leads to massive undercounting because every 24 hours is hidden.

Tips

  • Keyboard Shortcut: To quickly enter the current time into a cell, press Ctrl + Shift + : (colon).
  • Consistent Formatting: Use the "Format Painter" (the paintbrush icon on the Home tab) to quickly apply the [h]:mm custom format to an entire column of duration results.
  • Adding Durations: To sum up a column of durations, use the =SUM() function, but remember that the total cell must be formatted with [h]:mm to show totals over 24 hours.

Troubleshooting

If your calculations are not working as expected, try these steps in order:

  1. Check for Text Formatting: If the formula returns a #VALUE! error, your times are likely stored as text. Select the column, go to the Data tab, select Text to Columns, and click Finish immediately. This often forces Excel to re-evaluate text as numbers.
  2. Fix the "Hashtag" Error: If you see #######, it usually means the result is negative or the column is too narrow. If the column is wide enough, your end time is likely smaller than your start time. For overnight shifts, use the formula: =IF(B2. Adding "1" represents adding one full day to the end time.
  3. Verify Regional Settings: If you are using a comma instead of a period or a different time separator based on your region, ensure your entries match your system's regional settings found in the Windows or macOS Control Panel.

Frequently Asked Questions

How do I calculate time duration across two different dates?

The easiest way is to include the date and time in the same cell (e.g., "2023-12-01 08:00"). Subtract the start cell from the end cell, and use the custom format [h]:mm to see the total hours elapsed across multiple days.

Why does my time result look like a decimal (e.g., 0.125)?

Excel stores time as a fraction of a 24-hour day. 0.5 equals 12 hours. To fix this, change the cell format to Time or a custom [h]:mm format.

Can I calculate duration in minutes only?

Yes. Subtract the times and multiply the result by 1440 (the number of minutes in a day): =(B2-A2)*1440. Format the result cell as a Number.

How do I subtract a break time from a total duration?

Simply subtract the break duration from your initial result. For example: =(B2-A2)-C2, where C2 is the duration of the break (entered as 0:30 for 30 minutes).

Does this work in Google Sheets as well?

Yes, the subtraction logic and the custom number format [h]:mm work almost identically in Google Sheets.