How to calculate hours between two dates and times in Excel
Formula (Excel and Google Sheets)
=(C2-B2)*24Subtract the two date-times and multiply by 24: =(C2-B2)*24. It works across midnight and across several days.
- Result on the example
- one result per row in
D2, filled down toD6 - Works in
- Every current version
- Google Sheets
- Same formula
See it work
The formula is already in D2, filled down to D6. Change any input and the result updates, or edit the formula to experiment.
How it works
A date-time is a date number plus a time fraction, so subtracting two of them gives days with a fraction, even across midnight or several days. Multiplying by 24 gives hours: March 2 at 2:00 PM to March 4 at 10:30 AM is 1.85 days, or 44.5 hours.
=(C2-B2)*24Result7.5
C23/2/2026 16:45The value in C2.
B23/2/2026 9:15The value in B2.
C2-B20.3125The - operator subtracts.
C2-B2)*247.5The * operator multiplies.
In Google Sheets
The same formula works in Google Sheets: =(C2-B2)*24. We ran it in Google Sheets mode on the same data and it returns the same results.
Other ways to do it
Each one was run on the same example sheet.
| Formula | Result | When to use it |
|---|---|---|
| =ROUND((C2-B2)*24,2) | 7.50, 44.50, 3.50… | Rounded to two decimals, which removes floating-point noise. |
| =INT(C2-B2)&" days "&TEXT(C2-B2,"h:mm") | 0 days 7:30, 1 days 20:30, 0 days 3:30…Different result | Days plus hours and minutes, like 1 days 20:30. Text in days and h:mm. |
Common mistakes
- If the dates and times are in separate columns, add each pair first:
=((D2+E2)-(B2+C2))*24. - Text timestamps can't be subtracted. Convert them with DATEVALUE and TIMEVALUE.
Try it yourself
Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.
Calculate hours between two dates and times
D2, calculate the hours from opened to resolved, and fill down to D6.Questions
How do I count business hours only?
Use NETWORKDAYS with MEDIAN to trim each end to opening hours; see the working-hours formula.
How do I show the result as days, hours and minutes?
=INT(C2-B2)&"d "&TEXT(C2-B2,"h""h ""m""m""") gives 1d 20h 30m.
Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.