To calculate the time difference in Excel, subtract the start time from the end time using a simple subtraction formula: =End_Time - Start_Time. Because Excel treats time as a fraction of a 24-hour day, you must apply specific cell formatting to ensure the result displays as hours and minutes rather than a decimal number.

What You'll Need

  • Microsoft Excel (any modern version)
  • A dataset containing at least two columns: one for the start time and one for the end time
  • Times entered in a recognized time format (e.g., 8: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 the cells are formatted as "Time."
  2. Insert the Subtraction Formula: Click on the cell where you want the difference 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 =B2-A2.
  3. Press Enter: Press the Enter key. Excel may automatically format the result as a time, or it may show a decimal number.
  4. Apply Custom Formatting: To ensure the result is readable, right-click the result cell and select Format Cells. In the Category list, select Custom.
  5. Define the Time Display: In the Type box, enter one of the following codes based on your needs:
    • h:mm for hours and minutes (e.g., 8:30).
    • [h]:mm for total hours that exceed 24 (essential for timesheets).
    • mm:ss for minutes and seconds.
  6. Fill the Formula Down: Hover your mouse over the bottom-right corner of the result cell until a small black cross (the fill handle) appears. Click and drag this handle down to apply the calculation to the rest of your rows.

Common Mistakes

  • Subtracting in the Wrong Order: If you subtract the end time from the start time (Start - End), Excel will return a series of hashtags (#######). This happens because Excel cannot display negative time values by default. Always use End Time - Start Time.
  • Using Standard "Hour" Formatting for Long Durations: If your total time difference exceeds 24 hours, using the h:mm format will "reset" the clock. For example, 25 hours will appear as 1:00. To fix this, always use square brackets: [h]:mm.
  • Mixing Date and Time: If your times span across midnight (e.g., starting at 10:00 PM and ending at 2:00 AM), a simple subtraction will fail. You must include the date in the cell (e.g., 2023-10-01 22:00) for Excel to calculate the difference correctly.

Tips

  • Convert Time to Decimals: If you need to multiply the time difference by an hourly rate (e.g., for payroll), you must convert the time to a decimal. Since Excel stores time as a fraction of a day, multiply the result by 24. Example: =(B2-A2)*24. Change the cell format to "Number" or "General" to see the result as a decimal (e.g., 8.5 hours instead of 8:30).
  • Use the TEXT Function: If you want the result to appear as a sentence (e.g., "8 hours and 30 minutes"), use the formula: =TEXT(B2-A2, "h ""hours and"" mm ""minutes""").
  • Quick Entry: Use the keyboard shortcut Ctrl + Shift + : (colon) to quickly insert the current time into a cell.

Troubleshooting

If your time difference calculation is not working as expected, try these steps in order:

  1. Check for Text Formatting: Sometimes times are imported as text rather than numbers. If the formula returns a #VALUE! error, select the column, go to the Data tab, select Text to Columns, and click Finish immediately. This often forces Excel to recognize the values as numbers/times.
  2. Verify the Cell Format: If you see a decimal like 0.354, the math is correct, but the formatting is wrong. Right-click the cell > Format Cells > Time.
  3. Handle Midnight Cross-overs: If you don't have dates in your cells but the time crosses midnight, use this formula to prevent negative results: =MOD(B2-A2, 1). The MOD function tells Excel to treat the result as a positive value within a 24-hour cycle.

Frequently Asked Questions

Why does my time difference show as #######?

This usually means the result of your formula is a negative number, which Excel cannot display in time format. Ensure you are subtracting the earlier time from the later time.

How do I calculate the difference between two dates and times?

Simply subtract the start date/time cell from the end date/time cell. Use the custom format [h]:mm to see the total number of hours elapsed across multiple days.

Can I calculate the difference in only minutes?

Yes. Subtract the times and then multiply the result by 1440 (which is 24 hours * 60 minutes). Format the result cell as "General" or "Number."

How do I subtract a specific amount of time (like a 30-minute break) from a total?

Use the TIME function. For example, to subtract 30 minutes from a difference in cell C2, use: =C2 - TIME(0, 30, 0).

Does the time difference formula work in Google Sheets?

Yes, the subtraction logic =B2-A2 and the custom formatting options are nearly identical in Google Sheets.