Calculate the Difference Between Start and End Times in Excel
Question details
Calculate the duration between start and end times and apply the formula across a large worksheet range.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Start and end times are listed in separate columns, and each row needs an elapsed-time calculation.
- Observed behavior
- The desired result is a duration for each row, displayed in a suitable time format.
Check that the start and end entries are recognized as Excel times or date-and-time values, rather than text. If a duration can exceed 24 hours, include the dates in both entries.
Subtract the Start Time from the End Time
Use a simple formula for times on the same day or for entries that include dates.
With the start time in A1 and the end time in B1, select C1, enter =B1-A1, and press Enter.
Select C1 and drag the fill handle down, or enter a range such as C1:C10000 in the Name Box and press Ctrl+D to fill the formula down.
Select the result cells, open Format Cells, and choose Custom. Enter [h]:mm:ss to show total hours, including durations longer than 24 hours.

Calculate a Time-Only Interval That Crosses Midnight
Use MOD when the end time may be on the following day and the duration is less than 24 hours.
Calculate Time Differences in WPS Spreadsheets
Use a subtraction formula in WPS Spreadsheets to calculate elapsed time, fill it down your worksheet, and display total hours.
- 1. Open the worksheet: Open your Excel file in WPS Spreadsheets and locate the start and end time columns.
- 2. Calculate the difference: If A1 contains the start and B1 contains the end, enter =B1-A1 in C1 and press Enter.
- 3. Fill the formula down: Select C1 and drag its fill handle down the rows that need a duration.
- 4. Format the results: Select the result cells, open Format Cells > Custom, and enter [h]:mm:ss to display total hours.

Frequently Asked Questions
How do I show more than 24 hours in an Excel duration?
Select the result cells, open Format Cells > Custom, and use [h]:mm:ss. Include dates in the start and end entries so Excel can calculate intervals spanning days.
What formula should I use for a shift that ends after midnight?
For time-only entries in A1 and B1, use =MOD(B1-A1,1) when the shift is less than 24 hours. Format the result as [h]:mm:ss.
How can I fill the formula down thousands of rows?
Enter the formula in C1, then select the desired range, such as C1:C10000, using the Name Box. Press Ctrl+D to fill the formula down.
Why does Excel show a negative time or hash marks?
The end value may be earlier than the start value, or the column may be too narrow. Check the dates and times, widen the result column, and use =MOD(B1-A1,1) for a time-only interval that crosses midnight and is under 24 hours.




