How to Calculate Hours Between Two Times in Google Sheets
Use this premium calculator to get worked hours, decimal time, and ready-to-paste Google Sheets formulas.
Expert Guide: How to Calculate Hours Between Two Times in Google Sheets
If you are tracking employee shifts, freelancer billable time, study sessions, or project logs, learning how to calculate hours between two times in Google Sheets is one of the most practical spreadsheet skills you can build. Most people begin with simple subtraction, but quickly run into confusing issues: midnight crossings, negative time values, lunch break deductions, decimal conversion for payroll, and formatting that shows dates instead of hours. This guide will walk you through all of it in a clean, practical workflow.
At a high level, Google Sheets stores times as fractions of a 24-hour day. For example, noon is 0.5 because it is half of a full day. This is why subtraction works: end time minus start time gives a time fraction, and that fraction can be formatted as hours and minutes or multiplied by 24 to show decimal hours.
Quick Formula Patterns You Should Memorize
- Same-day time difference:
=B2-A2 - Cross-midnight safe formula:
=MOD(B2-A2,1) - Subtract unpaid break in minutes:
=MOD(B2-A2,1)-C2/1440 - Convert to decimal hours:
=(MOD(B2-A2,1)-C2/1440)*24 - Round to quarter hour:
=MROUND(((MOD(B2-A2,1)-C2/1440)*24),0.25)
These formulas solve almost every time-difference scenario. The only thing that changes is formatting and business policy (for example, exact minutes versus rounding to 0.25 hours).
Step 1: Structure Your Timesheet Correctly
Start with clear column labels. A recommended layout is:
- Column A: Start Time
- Column B: End Time
- Column C: Break Minutes
- Column D: Net Duration (hh:mm)
- Column E: Net Decimal Hours
In Sheets, format A and B as Time. Format C as Number. For D, use custom format [h]:mm to display more than 24 hours in totals. For E, use Number with 2 decimals.
Step 2: Calculate Hours for Same-Day Shifts
If shifts always start and end on the same day, use simple subtraction in D2:
=B2-A2
Then apply the [h]:mm format. If A2 is 09:00 and B2 is 17:30, the result is 8:30. If you need decimal hours for billing in E2, use:
=D2*24
This returns 8.5.
Step 3: Handle Overnight Shifts Without Errors
The classic issue appears when someone works from 10:00 PM to 6:00 AM. Simple subtraction returns a negative value. The safe fix is MOD:
=MOD(B2-A2,1)
This wraps negative time into the correct next-day duration. That one function is the reason many payroll templates stay stable in production.
Step 4: Subtract Break Time
Breaks are often stored in minutes because managers and staff enter values like 30, 45, or 60. Since Sheets time is day-based, convert minutes to day fraction by dividing by 1440 (24 x 60):
=MOD(B2-A2,1)-C2/1440
Use a validation rule so break minutes are never negative. You can also cap unreasonable entries with data validation, such as 0 to 180.
Step 5: Convert Duration to Payroll-Friendly Decimal Hours
Many payroll and invoicing workflows require decimal hours, not hh:mm. Once you have net duration, multiply by 24:
=(MOD(B2-A2,1)-C2/1440)*24
Examples:
- 7:30 becomes 7.50
- 7:45 becomes 7.75
- 7:15 becomes 7.25
This is usually the figure sent to accounting platforms, contractor invoices, and labor-cost reports.
Step 6: Add Rounding Policies When Required
Some organizations round to 5, 6, or 15 minute intervals. If your policy is quarter hour, round decimal hours to 0.25 increments:
=MROUND(((MOD(B2-A2,1)-C2/1440)*24),0.25)
If policy requires nearest 6 minutes (0.1 hours), replace 0.25 with 0.1. Always check legal and contractual guidance for your location before adopting rounding rules in attendance systems.
Real-World Benchmarks: Why Precise Time Calculation Matters
Time math might seem like a small operational detail, but it has a direct effect on payroll integrity, productivity analysis, and compliance. Public datasets from U.S. agencies show why accurate hour calculations are not optional.
| Metric | Statistic | Why It Matters for Sheets Formulas | Source |
|---|---|---|---|
| Employed people on days worked | About 7.9 hours worked per day | Small formula errors repeated daily can create significant payroll drift over a year | BLS ATUS |
| Private sector average weekly hours | Roughly mid-30 hour range in national labor reports | Weekly totals are core labor metrics, so consistent decimal conversion is critical | BLS CES |
| U.S. daylight saving changes | Two annual clock changes, each 1 hour | Night shifts near transition dates need explicit date handling, not only time fields | NIST Time and Frequency |
For practical reference, see these authoritative resources: Bureau of Labor Statistics American Time Use Survey, BLS Current Employment Statistics, and NIST Time and Frequency Division.
Comparison Table: Common Google Sheets Methods
| Method | Formula | Best Use | Risk Level |
|---|---|---|---|
| Simple subtraction | =B2-A2 |
Same-day start and end only | Medium if overnight shifts exist |
| MOD subtraction | =MOD(B2-A2,1) |
Mixed same-day and overnight logs | Low for most schedules |
| MOD plus break | =MOD(B2-A2,1)-C2/1440 |
Attendance and payroll workflows | Low if break validation is applied |
| Decimal payroll | =(MOD(B2-A2,1)-C2/1440)*24 |
Invoicing, billing, labor costing | Low if rounded and audited |
Advanced Scenarios You Should Prepare For
- Multi-day shifts: Use full datetime stamps instead of time-only cells. Example:
=B2-A2where both include date and time. - DST crossover shifts: If someone works during spring or fall clock change, include timezone-aware date records and review manually.
- Missing punches: Wrap formulas in IF checks, such as
=IF(OR(A2="",B2=""),"",MOD(B2-A2,1)). - Negative net after break deduction: Add validation to ensure break minutes cannot exceed gross duration.
- Large monthly totals: Use
[h]:mmformat so totals above 24 hours display correctly.
Common Mistakes and Fixes
- Mistake: Times stored as text. Fix: Reformat cells as Time and re-enter values or use
TIMEVALUE(). - Mistake: Negative result for overnight. Fix: Switch to
MOD(B2-A2,1). - Mistake: Decimal looks wrong (for example 0.35). Fix: Multiply duration by 24 for decimal hours.
- Mistake: Totals reset every 24 hours. Fix: Use custom format
[h]:mm. - Mistake: Break time entered as 0:30 in one row and 30 in another. Fix: Standardize break entry format and data validation.
Template Blueprint for Teams
If you manage a team, build a repeatable sheet with these controls:
- Header row locked and protected
- Time columns validated to prevent text entries
- Break column constrained to a rational range
- Formula columns protected from edits
- Summary section with total hours, overtime threshold, and project splits
Then add conditional formatting to flag rows where net hours are unusually high or where start and end are identical, which may indicate missed punches.
Should You Store Time as hh:mm or Decimal?
Use both. Human reviewers read hh:mm faster, while payroll engines and cost models often need decimal values. A robust workflow stores raw start and end times, computes net duration in hh:mm, then derives decimal hours from that single source. This reduces inconsistencies between operational reporting and finance exports.
Final Workflow You Can Implement Today
- Collect Start Time, End Time, and Break Minutes.
- Compute net duration with
MODto handle overnight shifts. - Display net time with
[h]:mmformat. - Multiply by 24 to generate decimal hours for payroll or billing.
- Apply rounding policy only if your organization requires it.
- Audit a weekly sample for anomalies before final submission.
Once you apply this structure, calculating hours between two times in Google Sheets becomes reliable, scalable, and much easier to audit. Use the calculator above to test scenarios quickly, then copy the generated formula pattern into your own sheet.
Tip: If your team spans multiple regions, store full datetime with timezone notes for night shifts and month-end cutoffs. Time-only fields are great for daily logs, but datetime fields are safer for compliance-grade reporting.