Mastering time calculations in spreadsheets is a fundamental skill for anyone managing schedules, tracking project hours, or processing payroll. Unlike standard integers, time values in Excel are stored as fractional parts of a day, which often leads to confusing results if the underlying logic isn't understood. This guide provides a comprehensive walkthrough on how to add or subtract time in Excel, covering basic arithmetic, handling durations exceeding 24 hours, using dedicated functions, and troubleshooting common formatting pitfalls Less friction, more output..
Understanding How Excel Stores Time
Before diving into formulas, it is critical to grasp the internal mechanism. Excel does not store time as "hours:minutes:seconds" in the way humans read it. Instead, it uses a serial number system where:
- Dates are whole numbers (integers) representing the number of days since January 0, 1900.
- Time is stored as a decimal fraction of a 24-hour day.
For example:
- 12:00 PM (Noon) = 0.On the flip side, 5 (half a day)
- 6:00 AM = 0. 25 (a quarter of a day)
- 1 hour = 1/24 ≈ 0.That said, 04167
- 1 minute = 1/(24*60) = 1/1440 ≈ 0. 000694
- 1 second = 1/(246060) = 1/86400 ≈ 0.
When you type 6:00 into a cell, Excel automatically applies a Time format, displaying the decimal 0.25 as 6:00 AM. Knowing And that's what lets you manipulate time mathematically just like any other number Worth keeping that in mind..
Basic Addition and Subtraction Using Operators
The most straightforward method to add or subtract time is using the standard + and - arithmetic operators. This works perfectly for combining two time values or calculating the difference between a start and end time Worth keeping that in mind..
Adding Two Time Values
If cell A1 contains 8:00 (start time) and B1 contains 2:30 (duration), the formula =A1+B1 returns 10:30 Not complicated — just consistent. But it adds up..
Subtracting to Find Duration
If A1 is 17:00 (End Time) and B1 is 9:00 (Start Time), =A1-B1 returns 8:00 (8 hours duration) Surprisingly effective..
Critical Limitation: Standard time formats (h:mm or hh:mm:ss) reset at 24 hours. If you add 15:00 + 12:00, the mathematical result is 27:00, but a standard format will display 3:00 (rolling over to the next day). To see the true accumulated hours, you must apply a custom format (covered in the next section).
Handling Durations Over 24 Hours: Custom Formatting
This is the single most common frustration for users. When summing a column of hours for a weekly timesheet, the total often looks wrong because the format hides the day count Most people skip this — try not to..
The Solution: Square Bracket Syntax
To display total hours exceeding 24, you must use a Custom Number Format with square brackets around the hour code.
- Select the cell containing your total formula.
- Press
Ctrl + 1(orCmd + 1on Mac) to open Format Cells. - Go to the Number tab > Custom.
- In the Type box, enter:
[h]:mm(for hours and minutes) or[h]:mm:ss(including seconds). - Click OK.
The square brackets [h] tell Excel: "Display the total elapsed hours, do not reset at 24." Now, 27:00 displays correctly as 27:00 instead of 3:00.
Using the TIME Function for Precise Construction
While you can type time values directly into cells, the TIME function is invaluable for building time values dynamically from separate hour, minute, and second components—especially when those components come from other calculations or cell references And that's really what it comes down to..
Syntax
=TIME(hour, minute, second)
Practical Examples
- Add 3 hours and 30 minutes to a time in A1:
=A1 + TIME(3, 30, 0) - Subtract 45 minutes from a time in A1:
=A1 - TIME(0, 45, 0) - Create a specific time from cells: If
B1=14,C1=30,D1=0:=TIME(B1, C1, D1)returns14:30(2:30 PM).
Behavior Note: The TIME function automatically rolls over excess minutes/seconds. TIME(12, 75, 0) evaluates to 13:15 (1:15 PM). On the flip side, the hour argument is truncated modulo 24. TIME(25, 0, 0) becomes 1:00 AM (hour 1). If you need to add more than 24 hours using a function, you must add the day integer separately (e.g., =A1 + 1 + TIME(2,0,0) adds 26 hours) No workaround needed..
Adding/Subtracting Hours, Minutes, or Seconds Directly
Because time is a fraction of a day, you can perform math using fractional math directly in formulas without the TIME function. This is often faster to type for simple offsets Simple, but easy to overlook..
The Fraction Logic
- 1 Hour =
1/24 - 1 Minute =
1/1440(24*60) - 1 Second =
1/86400(246060)
Formula Examples (assuming Time in A1)
| Operation | Formula | Explanation |
|---|---|---|
| Add 5 Hours | =A1 + 5/24 |
Adds 5 * (1/24) |
| Add 30 Minutes | =A1 + 30/1440 |
Adds 30 * (1/1440) |
| Add 45 Seconds | =A1 + 45/86400 |
Adds 45 * (1/86400) |
| Subtract 1.5 Hours | =A1 - 1.5/24 |
Subtracts decimal hours |
Pro Tip: For readability, you can define these fractions as named constants (Formulas > Name Manager) named OneHour, OneMinute, OneSecond, making formulas read like =A1 + 5*OneHour Most people skip this — try not to. Which is the point..
Calculating Elapsed Time Across Midnight
A classic "gotcha" occurs when a shift starts at 22:00 (10 PM) and ends at 06:00 (6 AM) the next day. A simple subtraction =End - Start yields a negative number (displayed as ####### or -0.Day to day, 666... ), because Excel sees the end time as smaller than the start time on the same day serial number.
The Fix: The MOD Function or IF Logic
You have two strong options to handle overnight durations.
Option 1: MOD Function (Cleanest)
`=MOD