Search Authority

How to Calculate Hours in Excel: Easy Step-by-Step Guide

Calculating hours in Excel is a practical skill for project planning, timesheet tracking, and payroll. With the right formulas, you can add, subtract, and format time values qui...

Mara Ellison
How to Calculate Hours in Excel: Easy Step-by-Step Guide

Calculating hours in Excel is a practical skill for project planning, timesheet tracking, and payroll. With the right formulas, you can add, subtract, and format time values quickly and accurately.

This guide walks through core techniques, common pitfalls, and best practices so you can handle hours confidently in any workbook.

Custom format [h]:mm
Operation Formula Example Result Notes
Add hours to a time =A2+TIME(2,30,0) 10:30 AM + 2:30 = 13:00 Use TIME to keep values in proper time format
Subtract start from end time =B2-A2 17:00 − 9:00 = 8:00 Apply a duration number format [h]:mm
Total hours across multiple rows =SUM(C2:C10) 22:15 total Ensure cells are formatted consistently
Convert decimal to hours =A2/24 7.5 → 7:30

Basic Formula Techniques for Hours

Simple math and time functions let you calculate hours between events and accumulate totals. The key is using time values that Excel recognizes as real times rather than plain numbers.

Use the TIME function to build a time like 3 hours and 45 minutes with =TIME(3,45,0). To add this to a start time in A2, enter =A2+TIME(3,45,0). For elapsed time between a start and end, subtract directly with =B2-A2, then format the result with [h]:mm to see hours beyond 24 correctly.

Formatting Cells Correctly

Wrong formatting causes confusing results like ##### or negative times that appear as dates. Choose the right format based on whether durations can exceed 24 hours.

For durations up to 24 hours, apply h:mm. For durations that can go beyond a day, use [h]:mm. This square bracket tells Excel to accumulate hours rather than wrap at 24, so 30 hours displays as 30:00 instead of 6:00.

Handling Negative Time Results

If an end time sometimes appears on the next day or earlier than the start, you need error handling to keep calculations stable.

Use MAX or IF to avoid negative times, for example =IF(B2>A2,B2-A2, B2-A2+1). Alternatively, wrap with ABS if you only care about magnitude, or use MOD like =MOD(B2-A2,1) to always return a positive fraction of a day regardless of date roll-over.

Summing Hours Across Many Rows

When you work with logs or timesheets, SUM gives you total hours quickly, but formatting and cell references matter.

Place =SUM(C2:C50) in a total cell and set the result format to [h]:mm. This adds all duration values and shows a true daily hour count instead of a time-of-day value. You can also combine SUM with ARRAYFORMULA in Google Sheets or FILTER inside SUM to add only specific shifts.

Converting Decimal Hours and Minutes

Imported data often stores time as decimal numbers, such as 8.25 for 8 hours and 15 minutes. Converting cleanly avoids rounding surprises.

For decimal hours, use =A2/24 and format as [h]:mm. For decimal minutes, divide by 1440 since there are 1,440 minutes in a day. Another option is =HOUR(A2)+MINUTE(A2)/60 to get a decimal representation directly, which is useful for billing rates that are calculated per hour.

Advanced Scenarios and Automation

Complex schedules may require combining functions to handle breaks, overtime thresholds, and different pay rates.

You can nest IF statements to assign higher rates after 8 hours, use MIN and MAX to cap daily work at a legal limit, or calculate break deductions by subtracting a break time value from total shift length. Named ranges can make formulas easier to read, and data tables help you compare totals under different hour scenarios.

Key Takeaways for Working with Hours in Excel

  • Use [h]:mm formatting for durations longer than 24 hours
  • Build durations with TIME(hours,minutes,seconds)
  • Subtract start from end and handle negatives with IF or MOD
  • Sum hours across ranges to get accurate totals
  • Convert decimals by dividing by 24 or by 1440 for minutes

FAQ

Reader questions

How do I display total hours over 24 correctly?

Apply the custom format [h]:mm to the total cell so hours accumulate beyond 24 instead of wrapping to a time of day.

What should I do if my subtraction gives a negative time?

Use =IF(end>=start, end-start, end-start+1) to keep valid durations even when crossing midnight.

How can I convert decimal 7.5 to 7:30 in Excel?

Divide by 24 with =A2/24 and format the result with [h]:mm to show 7 hours 30 minutes correctly.

How do I total only hours between 9 AM and 5 PM excluding breaks?

Use SUM with MAX and MIN to clamp values within the work window and subtract a break cell formatted as time.

Related Reading

More pages in this topic cluster.

Who Designed the Nike Logo? The Story Behind the Swoosh

The Nike swoosh is one of the most recognizable symbols in the world, but few people know the story behind its creation. This piece explores who designed the Nike logo, why it h...

Read next
What is the World's Hottest Pepper? 🌶️🔥

When people ask about the world's hottest pepper, they usually mean the variety that currently holds the Guinness World Record and pushes the boundaries of capsaicin heat. Peppe...

Read next
Jon Huertas in This Is Us:角色, 出演时期与剧情影响详解

Jon Huertas 在《这就是我们》中饰演成年 Kevin Pearson,这一角色从2016年首播持续至2022年最终季,构成了剧集核心家庭叙事的重要组成部�...

Read next