Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Compute Time in Excel

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Excel can calculate time differences, add or subtract hours and minutes, and convert time values into decimal numbers for payroll or scheduling—no manual math needed. To do this accurately, you must enter time in a format Excel recognizes and apply the right formulas. Time in Excel is stored as a fraction of a day, so understanding this helps avoid errors.

What You'll Need

  • Microsoft Excel (2010 or later, desktop or web version)
  • A data set with start and end times entered correctly (e.g., 8:30 AM, 17:45)
  • Cells formatted as Time or General/Number for results

Step-by-Step

  1. Enter your start time in one cell (e.g., A2) and end time in another (e.g., B2). Use a 12-hour or 24-hour format Excel recognizes: 9:00 AM, 14:30, or 9:00 are all valid. Do not type "9 hours" or "9:00am" with extra text.
  2. Click the cell where you want the result (e.g., C2). This will show the duration between start and end times.
  3. Type the formula =B2-A2 and press Enter. Excel subtracts the earlier time from the later one and displays the result as a time duration (e.g., 5:30 for five and a half hours).
  4. If the result appears as a number (like 0.229167) or shows #####, right-click the cell, choose Format Cells, then select Time from the Category list. Choose a format like 13:30 or h:mm to display it correctly.
  5. To calculate total hours as a decimal (e.g., 5.5 instead of 5:30), multiply the result by 24. Use =(B2-A2)*24. Format the result cell as Number with one or two decimal places.
  6. To add time (e.g., schedule multiple tasks), use =A2+TIME(2,30,0) to add 2 hours and 30 minutes to a start time. Replace 2 and 30 with your desired hours and minutes.
  7. To subtract time (e.g., deduct a break), use =B2-TIME(0,15,0) to subtract 15 minutes from an end time. Always use the TIME function for adding/subtracting hours/minutes/seconds to avoid errors.
  8. For durations spanning midnight (e.g., start 11:00 PM, end 2:00 AM the next day), use =IF(B2<A2,B2+1,B2)-A2. This adjusts for the date rollover by adding 1 day if the end time is earlier than the start.

Common Mistakes

  • Typing time as text (e.g., "9am" without a space or "9:00 hours") prevents Excel from recognizing it as a time value. Always use a standard format.
  • Forgetting to format the result cell as Time or Number leads to decimal displays or ##### errors. Always check cell formatting after entering a formula.
  • Using subtraction without accounting for midnight crossings causes negative results. Use the IF formula in Step 8 if your period crosses midnight.
  • Trying to add time with simple numbers (e.g., =A2+2.5) adds 2.5 days, not 2.5 hours. Use the TIME function instead.
  • Copying formulas without adjusting cell references (e.g., dragging from C2 to C3 but A3 and B3 are empty) returns zero or #VALUE!.

Tips

  • Use Ctrl+Shift+; to insert the current time into a cell quickly, or Ctrl+; for today’s date.
  • When calculating payroll, multiply the duration by 24 and then by the hourly rate: =(B2-A2)*24*E2 where E2 is the pay rate per hour.
  • Use Conditional Formatting to highlight durations longer than 8 hours: select the column, choose Home > Conditional Formatting > New Rule > Use a formula, then enter =C2>8/24 and set a fill color.
  • For large datasets, use the TEXT function to display durations as readable strings, like =TEXT(B2-A2,"h\:mm"), which shows "5:30" even if the underlying value is decimal.
  • Always use two-digit hours and minutes (e.g., 09:05, not 9:5) to ensure consistency, especially when importing data from other sources.
  • Save your file as .xlsx, not .xls, to avoid compatibility issues with time calculations.

Troubleshooting

  • If you see ##### in a cell, widen the column. Time values need space to display fully. Double-click the column header boundary to auto-fit.
  • If the formula returns #VALUE!, the input cells contain text instead of time. Check A2 and B2: if they’re left-aligned, they’re text. Re-enter the time in a clean cell, or use Text to Columns (Data tab) to convert.
  • If the result is negative when it shouldn’t be, check for midnight crossover. Use the IF formula in Step 8 to handle overnight periods.
  • If multiplying by 24 gives an odd decimal like 5.499999, format the cell as Number with two decimal places. This is a floating-point rounding issue—Excel’s internal math is correct, but display needs rounding.
  • If formulas don’t recalculate automatically, go to Formulas > Calculation Options and ensure it’s set to Automatic.
  • If you’re using Excel Online and the TIME function doesn’t work, switch to the desktop app; some advanced time functions have limited support in the browser version.

Frequently Asked Questions

How do I calculate total hours worked from multiple time entries?

Sum the individual durations using SUM. If A2:B2, A3:B3, A4:B4 each hold start/end times, use =SUM(C2:C4) where C2 contains =B2-A2, and so on. Format the result cell as [h]:mm to show total hours beyond 24.

Can I add minutes to a time without using the TIME function?

Yes, but it’s error-prone. Add minutes as a fraction of a day: 15 minutes = 15/(24*60) = 0.0104167. So =A2+0.0104167 adds 15 minutes. Use the TIME function instead: =A2+TIME(0,15,0) is clearer and less likely to be miscalculated.

Why does Excel show 12:00 AM when I subtract two equal times?

Because 0 days is displayed as 12:00 AM by default. If the result is zero, Excel treats it as midnight. Format the cell as General to see 0, or use an IF statement like =IF(B2=A2,"0:00",B2-A2) to show "0:00" instead.

How do I convert time to decimal minutes?

Multiply the time difference by 1440 (24 hours × 60 minutes). For example, =(B2-A2)*1440 converts 2:30 into 150 minutes. Format the result as Number.

Can I calculate time across multiple days?

Yes. Enter full date and time in each cell (e.g., 3/15/2024 9:00 AM). Excel stores dates as whole numbers and time as fractions, so subtracting two full datetime values works naturally. Just format the result as [h]:mm to show total hours across days.

What if my time data has AM/PM but Excel doesn’t recognize it?

Re-enter the times with a space before AM/PM (e.g., "9:00 AM" not "9:00AM"). If imported, use Find and Replace to add the space. Then select the column, go to Data > Text to Columns > Delimited > Next > Finish. This forces Excel to re-parse the values as time.