How to Get Days Hours And Minutes Between Dates in Excel
Learn multiple Excel methods to get days hours and minutes between dates with step-by-step examples, business use cases, and pro tips.
How to Get Days Hours And Minutes Between Dates in Excel
Why This Task Matters in Excel
When you schedule projects, calculate machine run-time, or audit employee work logs, you rarely care about dates alone. A shipping coordinator must promise to deliver merchandise in 3 days 4 hours 30 minutes. A hotel front desk needs to know that a guest stayed 2 days 20 hours to apply late-checkout fees. A data-center manager wants to report server downtime in exact hours and minutes—not round up or down to the nearest day.
Excel is ubiquitous in operations, finance, HR, and engineering precisely because it can turn raw timestamps into actionable metrics. Instead of relying on specialized software, you can store incoming and outgoing time-stamps in two columns and let Excel instantly show a precise gap. As soon as the interval updates, downstream KPIs—cost, penalties, service-level compliance—update automatically via formulas or connected dashboards.
Although the problem sounds simple (“subtract EndTime minus StartTime”), it involves three skills:
- Understanding how Excel internally stores dates and times as fractions of 24-hour days.
- Extracting whole days, then parsing the remaining fraction into hours and minutes without rounding errors.
- Presenting the result in a human-friendly format, or keeping it as a numeric value for further math.
If you skip any of these, you risk negative times, wrong day counts after midnight crossings, or inconsistent reporting between Windows and Mac systems. Mastering this technique therefore ties directly into trustworthy analytics, project scheduling, and compliance reporting—all staple workflows for power Excel users.
Best Excel Approach
The most flexible method is a single formula that:
- Subtracts the start timestamp from the end timestamp.
- Extracts the whole-day portion with the INT function.
- Uses the MOD function to keep only the fractional remainder.
- Converts that remainder into hours and minutes with the TEXT function.
- Concatenates everything into one readable line, or stores the parts in separate columns if preferred.
Syntax (recommended all-in-one):
=INT(EndTime-StartTime) &
" days " &
TEXT(MOD(EndTime-StartTime,1),"hh"" hrs ""mm"" mins""")
Why this works
- Excel stores 1 calendar day as the number 1. Any decimal part—0.25, 0.5, 0.75—represents a fraction of 24 hours. INT removes the decimal to isolate complete days.
- MOD returns only the decimal part, ensuring we never double-count days when converting hours.
- TEXT turns the time fraction into “hh hrs mm mins” while preserving leading zeros, e.g., “04 hrs 05 mins”.
Use this approach when you want one readable phrase, need dynamic updates, and your workbook must remain backward compatible to Excel 2010 or later. If you need separate numerical fields (for pivot tables or further math), split each component into its own column—see Alternative Methods below.
Parameters and Inputs
- StartTime – Required. A cell containing a valid Excel date/time serial such as 3/1/2024 08:30.
- EndTime – Required. A later timestamp in the same serial format.
- Both inputs must be genuine date-time values, not text strings. If data arrive as text (for example, from CSV imports), convert them with VALUE or DATEVALUE+TIMEVALUE first.
- The formula assumes EndTime ≥ StartTime. If EndTime is earlier, you’ll get a negative day value or the dreaded ##### display. Wrap the entire calculation in an IF test for robustness.
- Formatting: cells holding StartTime and EndTime can use any Custom format that contains both date and time (e.g., “m/d/yyyy h:mm AM/PM”).
- Edge cases: crossing daylight-saving boundaries, leap years, or time-zones do not affect the math because Excel stores absolute local timestamps. If you pull data from multiple time-zones, convert them to Universal Time before subtraction.
Step-by-Step Examples
Example 1: Basic Scenario
Scenario: A lab records the start and end of an experiment. You need to report the exact duration.
- Enter the following sample data:
| A | B |
|---|---|
| Start | End |
| 4/1/2024 09:15 | 4/3/2024 13:47 |
- In C2 type the label Duration.
- In C3 enter:
=INT(B3-A3) & " days " & TEXT(MOD(B3-A3,1),"hh"" hrs ""mm"" mins""")
- Press Enter. The result shows 2 days 04 hrs 32 mins.
Why it works
- B3-A\3 = 2.188… days.
- INT strips to 2.
- MOD(B3-A3,1) = 0.188… days. Multiply that by 24 to interpret as 4.5 hours. TEXT renders it exactly “04 hrs 32 mins”.
Common variations
- Replace
"hh"" hrs ""mm"" mins""with"h""h ""m""m"for shorter output. - If you only care about hours and minutes and want to drop “days” when the value is zero, wrap the INT portion in an IF statement.
Troubleshooting
- If you see #####, widen the column.
- If you see “2 days 04 hrs 31.9 mins”, your Text pattern is wrong—“mm” must be minutes, not “m”.
Example 2: Real-World Application
Business Context: A contact-center manager stores call logs with ArrivalTime and CloseTime in a table named Calls. She must compute resolution time for each ticket and aggregate the result into Service Level reports.
Data:
| Ticket | ArrivalTime | CloseTime |
|---|---|---|
| 1001 | 3/14/2024 22:50 | 3/15/2024 01:37 |
| 1002 | 3/15/2024 09:02 | 3/17/2024 10:33 |
| 1003 | 3/15/2024 14:28 | 3/15/2024 16:05 |
Steps:
- Convert [A1:C4] to an official Excel Table (Ctrl + T) so formulas auto-fill.
- Add a new column Duration and enter:
=LET(
start,[@ArrivalTime],
finish,[@CloseTime],
days,INT(finish-start),
timePart,MOD(finish-start,1),
days & " days " & TEXT(timePart,"hh"" hrs ""mm"" mins""")
)
- Excel spills the result for all rows.
- Create a PivotTable, drag Duration to Values, set it to Average. Because Duration is still text, use another helper column DurationHours:
=([@CloseTime]-[@ArrivalTime])*24
Now the pivot can produce true numeric averages.
Integration points
- Combine with Conditional Formatting to highlight tickets over 48 hours.
- Use a Power Query step to pre-calculate the difference before loading into the Data Model for faster DAX measures.
Performance
Even with 100,000 records, a Table-based LET formula recalculates quickly because each row handles only two numeric subtractions and one TEXT rendering.
Example 3: Advanced Technique
Scenario: You run a manufacturing plant that logs downtime across multiple time zones and needs to report total cumulative downtime per machine in days hours minutes format. The raw data arrive as UTC timestamps. You want a single formula that:
- Converts UTC to local time (UTC-5).
- Handles blank EndTime for outages still occurring.
- Returns a numeric value to feed into PivotTable totals while optionally displaying friendly text.
Solution (array-enabled Excel 365):
=LET(
startUTC,Table1[StartUTC],
endUTC,Table1[EndUTC],
offset,"-5:00",
localStart,startUTC+TIMEVALUE(offset),
localEnd,IF(endUTC="",NOW()+TIMEVALUE(offset),endUTC+TIMEVALUE(offset)),
delta,localEnd-localStart,
days,INT(delta),
rem,MOD(delta,1),
numeric,delta,
display,days & " days " & TEXT(rem,"hh"" hrs ""mm"" mins"""),
CHOOSE({1,2},numeric,display)
)
Explanation
- TIMEVALUE(offset) produces the decimal for UTC-5.
- Blank end times default to the current timestamp so ongoing outages keep accumulating.
- CHOOSE with [[1,2]] returns a two-column Spill: numeric duration and readable text. You can hide the display column or vice-versa.
Optimization
Move the time-zone conversion to Power Query if millions of rows arrive daily. That leaves only a simple subtraction inside the worksheet.
Error handling
Wrap localEnd-localStart in MAX(delta,0) to guard against future-dated StartTime due to input typos.
Tips and Best Practices
- Format inputs consistently – Store BOTH date and time in the same column to avoid 00:00 default times.
- Keep a numeric version – Use one column for math and a separate column formatted with a custom pattern
[h]:mm. The bracket syntax lets hours exceed 24, perfect for sum totals. - Protect against negatives – Wrap your formula with IF(EndTime<StartTime,\"Check data\",…) to flag entry errors early.
- Use Tables and structured references – They auto-copy formulas and survive row insertions, reducing maintenance.
- Avoid volatile functions when possible – NOW() recalculates every time; for static audit trails, paste values or use Power Query.
- Localize text strings – Replace \"days\" or \"hrs\" with cell references that hold label translations if your workbook serves multi-language teams.
Common Mistakes to Avoid
- Mixing text and serial numbers
New users often import CSV timestamps that look fine but are stored as text. Subtraction returns #VALUE!. Fix by wrapping with VALUE or using Data ➜ Text to Columns. - Relying on HOUR and MINUTE after subtracting days
HOUR end-start works only when both times are from the same calendar day. Use MOD for reliable results across multiple days. - Forgetting to use square brackets in custom formats
[h]:mmis essential; plainhh:mmresets at 24 hours, giving wrong totals in roll-ups. - Hard-coding the time zone offset
Daylight-saving shifts break UTC-to-local conversions if you simply add or subtract a constant. Store the offset in a cell and update it twice a year, or use Power Query which can detect Windows time zones. - Concatenating numbers without TEXT
2 & " days "returns “2 days” but0.25 & " days"turns into “0.25 days” instead of “0 days”. Always INT first or convert with TEXT.
Alternative Methods
| Method | Formula Core | Pros | Cons | Best Use |
|---|---|---|---|---|
| INT + MOD + TEXT (recommended) | see above | One cell, readable output, backward compatible | Output is text (not numeric) unless split | Dashboards, ad-hoc analysis |
| Separate Columns (Days, Hours, Minutes) | =INT(delta) etc. | Pure numbers for pivot charts | More columns to manage | Large aggregated reports |
Custom Cell Format [h]:mm | =End-Start then apply format | Keeps numeric integrity, sums easily | No explicit “days” word; users must interpret | Financial models needing totals |
| DATEDIF + HOUR + MINUTE | =DATEDIF(Start,End,"d") | Familiar to some users | DATEDIF is undocumented, fails beyond 32767 days | Legacy files |
| Power Query Duration.Type | UI-based; no formula | Handles millions of rows, auto-generates fields | Requires refresh, not dynamic within cells | ETL pipelines |
| VBA User-Defined Function | Custom code | Full control, complex logic | Macro security prompts | Template distributed in controlled environment |
Performance: For normal worksheets (<100,000 rows), differences are negligible. With millions of records, store raw timestamps and calculate in Power Query or SQL, then import summaries.
FAQ
When should I use this approach?
Use the INT-MOD-TEXT pattern when you need an on-sheet formula that updates instantly, you want human-readable results, and you operate within mainstream Excel versions without add-ins.
Can this work across multiple sheets?
Absolutely. Reference StartTime on Sheet1 and EndTime on Sheet2:
=INT(Sheet2!B2-Sheet1!A2) & " days " & TEXT(MOD(Sheet2!B2-Sheet1!A2,1),"hh"" hrs ""mm"" mins""")
Ensure both sheets share consistent time zones and formats.
What are the limitations?
The method assumes EndTime is after StartTime. It also outputs text, so you cannot directly SUM or AVERAGE it—keep a numeric helper. Finally, daylight-saving and time-zone conversions require extra steps outside simple subtraction.
How do I handle errors?
Wrap with IFERROR or create explicit checks:
=IF(ISNUMBER(StartTime)*ISNUMBER(EndTime),
INT(EndTime-StartTime)&" days "&TEXT(MOD(EndTime-StartTime,1),"hh"" hrs ""mm"" mins"""),
"Invalid input")
Highlight suspicious negatives with Conditional Formatting (“cell value less than 0”).
Does this work in older Excel versions?
Yes. Excel 2007 and later support INT, MOD, and TEXT. LET is available only in 365/2021; if you share with older versions, stick to the classic pattern without LET.
What about performance with large datasets?
Avoid volatile NOW() and TODAY() functions in thousands of rows. Where possible, calculate once in Power Query or store numeric deltas and use pivot tables for aggregation. Turn off automatic calculation or use Manual with F9 for very large models.
Conclusion
Knowing how to extract days, hours, and minutes between dates transforms raw timestamps into clear operational insight. Whether you manage service tickets, production downtime, or travel itineraries, the ability to turn two date-time stamps into precise intervals ties directly to costs, compliance, and customer satisfaction. By mastering the INT-MOD-TEXT technique (and its numeric or Power Query cousins), you strengthen your overall date-time fluency—a cornerstone skill that feeds into more advanced scheduling, forecasting, and dashboarding tasks. Try the examples on your own data, choose the method that fits your workflow, and watch your time-based reports become both accurate and insightful.
Related Articles
How to Show the 10 Most Common Text Values in Excel
Learn multiple Excel methods to list the 10 most frequent text values—complete with step-by-step examples, business use cases, and expert tips.
How to Abbreviate Names Or Words in Excel
Learn multiple Excel methods to abbreviate names or words with step-by-step examples and practical applications.
How to Abbreviate State Names in Excel
Learn multiple Excel methods to abbreviate state names with step-by-step examples, professional tips, and real-world applications.