Excel Formula to Calculate Hours Worked

This guide treats “excel formula to calculate hours worked” the way busy spreadsheet users actually want it: answer first, a live tool to prove it on your own data, then the reasoning. It is written for Excel but calls out every place Google Sheets differs, and the platform toggle at the top switches all shortcuts between Windows and Mac so nothing here assumes the keyboard you are not on.

Exact answer

In Excel: subtract the earlier time from the later one and format the result as [h]:mm — or multiply by 24 to get decimal hours you can pay against.

ƒxHours & Duration CalculatorLive
Duration
8:00

8.00 decimal hours

=(B2-A2+(B2<A2))*24-C2/60
=(End-Start)*24
Ctrl+CthenCtrl+Shift+V+Cthen+Ctrl+VPaste values · WindowsMac

Need it as an auditable file?

Ships inside the linked template — formula-driven, unlocked, audit-ready.

View template

What this does

Excel stores a time as a fraction of a day: 06:00 is 0.25, 12:00 is 0.5. Subtracting two times therefore gives a fraction of a day, and the formatting decides what you see. The square brackets in [h]:mm are the critical part — plain h:mm resets to zero after 24 hours, so a 30-hour total displays as 6:00, which is the classic wrong timesheet. Multiplying the difference by 24 converts it to decimal hours (7.5 rather than 7:30), which is what payroll arithmetic needs. A shift crossing midnight makes the subtraction negative; =MOD(End-Start, 1) handles it by wrapping into the next day. And where the two moments fall on different DATES, store date and time together in one cell — subtracting a bare 09:00 on Tuesday from a bare 17:00 on Monday cannot possibly know a day passed. The same idea underpins a lot of everyday Excel work, so the few minutes spent getting it right here pay back across every sheet you build afterwards. Treat it as a pattern, not a one-off, and it stops being something you look up and starts being something you reach for. The difference between a quick fix and a sheet you can trust is the extra minute you spend validating “excel formula to calculate hours worked”. Start on a copy or a tiny sample, keep the affected formula visible, and compare the result with the tool above before you touch the real workbook. When a formula is involved, keep the inputs labelled beside it, reference cells instead of typing values, and apply number formatting only after the result checks out. The point is a calculation you can defend to a CFO or an auditor, but the practical win is that someone else can open the file and understand what happened without asking you.

A worked example

Start 09:15 in B2, end 17:45 in C2. =C2-B2 formatted as [h]:mm shows 8:30. =(C2-B2)*24 formatted as a number shows 8.5 — the figure to multiply by an hourly rate. A night shift with start 22:00 and end 06:00: =C2-B2 shows ###### or a negative; =MOD(C2-B2, 1) shows 8:00. Timesheet arithmetic fails in exactly two ways — the 24-hour wrap and the midnight crossing — and both are one formatting choice and one MOD away from being right. One habit worth forming early: name the cells that hold your inputs, so the formula reads in plain language instead of a string of cell addresses. A reviewer — or you in three months — can then follow the logic without decoding what B7 and D2 were supposed to mean, which is most of what makes a sheet maintainable.

In Google Sheets

Everything above works in Google Sheets too. Excel and Sheets share the formula syntax used here; only the surrounding menus are arranged differently. That portability is deliberate — learn it once and it follows you between the two tools and across Windows and Mac. The aim was to get you unstuck fast and leave you a little more capable than a copy-paste would. The answer is at the top, the tool proves it, and the detail above shows why it holds — so the next time a colleague asks, you can answer without reaching for search. Treat “excel formula to calculate hours worked” as a small building block rather than a chore. Once the inputs sit in their own cells and the formula reads from them, the same setup answers a dozen related questions with a tweak, and Excel keeps every dependent figure current as the data changes. The tool above is there so you can rehearse and verify before committing anything to a real workbook; the steps and worked example are there so the logic sticks. Get it right once and it stops costing you time — it starts saving it, every time the question comes back around.

Common mistakes

  • Formatting a total as h:mm rather than [h]:mm, so anything over 24 hours silently wraps.
  • Subtracting bare times across midnight and getting ###### or a negative number.
  • Paying against a time value directly — 8:30 as a number is 0.354, so it must be multiplied by 24 first.
  • Entering times as text, which right-alignment (or the lack of it) reveals immediately.
  • Summing a column of daily durations without the bracket format, which is where the wrong weekly total comes from.

Frequently asked questions

How do I calculate the difference between two times in Excel?

Subtract the earlier from the later — =End-Start — and format the cell as [h]:mm.

How do I get the number of hours as a decimal?

Multiply the difference by 24: =(End-Start)*24, formatted as a plain number. 7:30 becomes 7.5.

Why does my time difference show ###### or a negative?

The shift crosses midnight, so End is numerically smaller than Start. Use =MOD(End-Start, 1).

Why does my total reset after 24 hours?

The cell is formatted h:mm. Change it to [h]:mm — the brackets are what let the hours run past 24.

Other ways people ask this

People reach this page typing “calculate hours worked excel formula”, “how to calculate hours worked in excel using 24-hour clock”, “how to calculate working hours in excel” and “calculate hours worked excel”, among other phrasings; whichever wording you used, the fix above is the one you want.

Why do people search for this in so many different ways?

Because the same task has many names. “calculate hours worked excel formula”, “how to calculate hours worked in excel using 24-hour clock”, “how to calculate working hours in excel” all point at the one operation explained on this page, which is why they all lead here.