Excel can calculate elapsed run time from start and end times, including runs that cross midnight, and display totals longer than 24 hours. You’ll need a spreadsheet with the relevant time values; the formulas below work in current desktop and web versions of Excel.
What You’ll Need
- An Excel worksheet with a start time and an end time for each run.
- Consistent time entries, such as 8:15 AM and 10:45 AM, or full date-and-time values when runs may span days.
- Optional: a duration column formatted to show hours beyond 24 if you are adding several runs.
Step-by-Step
- Set up columns for the run. Enter a heading such as Start in A1 and End in B1. Put the start time in A2 and the end time in B2. Excel recognizes entries such as
8:15 AM,14:30, and date-time values such as11/5/2026 11:30 PM. If you only have clock times, make sure both are entered as actual Excel times, not text. - Calculate a run that ends on the same day. In C1, enter Duration. In C2, type
=B2-A2and press Enter. For example, a start of 8:15 AM and an end of 10:45 AM gives 2 hours and 30 minutes. Excel stores times as fractions of a day, so subtracting the start from the end returns the elapsed time. - Format the duration so it is readable. Select C2, open the Home tab, and use the Number Format menu. Choose a time format such as
h:mmorh:mm:ss. To apply a custom format, open Format Cells and select Custom, then enter[h]:mmor[h]:mm:ss. The square brackets let the hour count exceed 24, which matters when you total runs. - Handle a run that crosses midnight. If you have only clock times and the end time is earlier than the start time, use
=MOD(B2-A2,1)in C2. For example, 10:30 PM to 2:15 AM produces 3:45. Apply the duration format from the previous step. This formula assumes an end time earlier than the start means the run finished the following day. - Use full dates when the run may span multiple days. If you know the actual dates, enter each start and end as date plus time—for example, a start date and time in A2 and the true end date and time in B2. Use
=B2-A2. This gives the correct elapsed period even when the run lasts more than one day. Format the result as[h]:mmor[h]:mm:ss. - Calculate durations for multiple runs. Put each run on a separate row, with starts in column A and ends in column B. Enter the appropriate duration formula in C2, then drag the fill handle down or copy and paste it into the other rows. Check that the cell references adjust for each row.
- Sum run times if needed. In the cell below the durations, enter
=SUM(C2:C10), changing the range to fit your data. Format the total as[h]:mmor[h]:mm:ss; otherwise, a standard time format may wrap after 24 hours and make the total look too small. - Show the answer as decimal hours, if required. If C2 contains a duration, use
=C2*24in another cell. Format that result as Number rather than Time. For instance, 1 hour 30 minutes becomes 1.5 hours. Multiply by 1440 for total minutes or 86400 for total seconds, then format the result as a number.
Common Mistakes
Using a normal clock format for a total. Formats such as h:mm can display a total of 27 hours as 3:00 because the clock cycles after 24 hours. Use the elapsed-time format [h]:mm for durations and sums.
Subtracting clock times across midnight without adjustment. A direct formula such as =B2-A2 can show a negative result if the end is after midnight and only clock times are entered. Use =MOD(B2-A2,1) for a single overnight run, or enter full dates and use ordinary subtraction.
Entering times as text. A time that looks correct may be stored as text after being imported or preceded by an apostrophe. Excel may not calculate it properly. Re-enter it as a time, or convert the source data to genuine Excel time values before calculating.
Mixing formats and units. A duration displayed as 2:30 means 2 hours and 30 minutes, not 2.30 decimal hours. Convert to decimal hours by multiplying the stored duration by 24, and format the result as a number.
Tips
- Use full date-and-time entries for records, shift logs, or any run that could last longer than a day. They remove ambiguity about which day the run ended.
- For repeated records, format the duration column as
[h]:mm:ssbefore copying formulas, so hours and seconds remain visible. - Keep the original start and end values in separate columns. This makes it easier to audit a duration or correct a mistyped time later.
- If you want a result in minutes, use
=(B2-A2)*1440for same-day times. For an overnight clock-time calculation, use=MOD(B2-A2,1)*1440. - Use cell formatting to control how a result looks; avoid rounding the underlying time unless your reporting rules specifically require it.
Troubleshooting
The formula displays #######. The column may be too narrow, or the result may be a negative duration displayed with a time format. Widen the column first. If the result is negative, check the start and end values and use the overnight formula or full dates as appropriate.
The total appears to be missing hours. Select the total cell and apply the custom format [h]:mm. A format without square brackets can roll over after 24 hours even when the underlying total is correct.
The result is a decimal such as 0.125. Excel stores a day as 1, so 0.125 represents three hours. Format the cell as [h]:mm to show elapsed time, or multiply by 24 if you want decimal hours.
The formula appears as text instead of calculating. Confirm that the formula begins with =, and check whether the cell is formatted as Text. Change the cell to General, then re-enter the formula. If formulas are displayed throughout the sheet, turn off Show Formulas from the Formulas tab or use its keyboard shortcut.
An overnight duration is unexpectedly long. The MOD formula treats any end time earlier than the start as the next day. If the run could span multiple days, use actual dates and times instead; clock times alone cannot identify how many days passed.
Frequently Asked Questions
What formula calculates elapsed time in Excel?
For a same-day run, subtract the start from the end: =B2-A2. Format the result as a time or elapsed-time value.
How do I calculate run time when it crosses midnight?
With clock times only, use =MOD(B2-A2,1). If you have the actual dates, enter date and time for both ends and subtract normally.
How do I show more than 24 hours?
Format the duration or total with the custom number format [h]:mm, or [h]:mm:ss to include seconds.
How do I calculate run time in decimal hours?
Multiply the duration by 24, as in =(B2-A2)*24, and format the answer as a number. For an overnight run using clock times, multiply the MOD formula by 24.
Can Excel calculate run time in seconds?
Yes. Multiply the duration by 86,400, the number of seconds in a day, and format the result as a number. For clock times across midnight, apply the same multiplier to MOD(B2-A2,1).
Why does Excel show a fraction instead of a time?
Excel stores time as a fraction of a 24-hour day. Apply a time format to show hours and minutes, or multiply by 24 to display decimal hours.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- How to Airdrop from iPhone to Samsung: Full Guide
- Fix Volume Keeps Going Up Down on Android
- Calculate Yardage Landscape: Formula & Calculator9.26 yd³
- Roth IRA at 40: Calculator & Guide433,769 $
- Post Judgment Interest Calculator QLD
- PPF Interest Rate Calculator: How It Works2,532,343 ₹