Instant digital downloadExcel and Google SheetsSecure card checkout

Excel and Google Sheets how-to

Calculate hours worked from start and end times

A shift from 9:00 to 17:30 is 8.5 hours, but subtract the times and the cell shows 8:30. One small change turns it into a number you can add up and multiply by a pay rate.

ABCD
1DayStartEndHours
2Mon9:0017:308.5
3Tue8:1512:454.5
4Wed13:0016:153.25
5Thu7:4516:008.25
6Fri9:0015:006

Sample data. Start times in B and end times in C, typed as times. D2 holds =(C2-B2)*24, filled down to row 6.

The formula

Type the start and end as times, like 9:00 and 17:30. Click D2 and type:

=(C2-B2)*24

D2 shows 8.5. Fill it down: Tuesday gives 4.5 and Wednesday 3.25, so a quarter hour shows as .25.

  • C2-B2 is the end minus the start.
  • *24 turns that into hours, because the spreadsheet counts time in days.
  • The brackets make it subtract first.

Why it shows 8:30 or 12:00

Excel and Google Sheets store a time as part of a day: 6:00 is 0.25 and 12:00 is 0.5. So =C2-B2 gives 0.354167, part of a day, and the app shows it as the time 8:30. It reads fine, but it is not 8.5 hours, and 8:30 times a pay rate gives a wrong answer.

Times 24 fixes the number. If the cell still looks like a time, for example 12:00 where you expect 8.5, the cell kept a time format. Format it as a number: in Excel, Home > Number Format > Number; in Google Sheets, Format > Number > Number.

Leave out the brackets and it goes wrong

=C2-B2*24

gives -8.27. Multiplying comes before subtracting, so the app works out B2*24 first (9:00 times 24 is 9) and takes that away from 0.73, the stored value of 17:30. Keep the brackets: =(C2-B2)*24.

Shifts that end after midnight

A night shift from 22:00 to 6:00 ends the next day, so the end time is smaller than the start, and =(C2-B2)*24 gives -16. MOD adds the missing day:

=MOD(C2-B2,1)*24

That gives 8. For a day shift MOD changes nothing: 9:00 to 17:30 still gives 8.5, so one formula covers every row, for any shift shorter than 24 hours.

Take off an unpaid break

Put the break in minutes in E2, for example 30, and take it off the hours:

=(C2-B2)*24-E2/60

9:00 to 17:30 with a 30 minute break gives 8. Dividing by 60 turns minutes into hours. If you type the break as a time instead (0:30), take it off before you multiply: =(C2-B2-E2)*24 gives the same 8.

Pay for the day and the week

Put the hourly rate in F1, for example 18.50, then:

=D2*$F$1

Monday pays 157.25. The dollar signs keep F1 fixed when you copy the formula down. Add up the week:

=SUM(D2:D6)

gives 30.5 hours, and =SUM(D2:D6)*$F$1 gives 564.25 for the week.

Week totals over 24 hours

If you keep hours as times (8:30) instead, a week total needs one more step. Add up the five days and 30 hours 30 minutes shows as 6:30, because a time format starts again after each 24 hours. Give the total cell the custom format [h]:mm and it shows 30:30. In Excel: right-click, Format Cells, Custom, then type [h]:mm. In Google Sheets: Format > Number > Duration, which shows 30:30:00.

For pay, hours as a number are easier: multiply the time total by 24 and you get 30.5.

Free practice sheet

Try it on three everyday jobs: hours from start and end times, night shifts that end after midnight, and pay after an unpaid break with a week total. Each tab has yellow cells to fill in and a Check column that says Correct or Try again as you type, plus an Answers tab. One Excel file that opens in Google Sheets too. Free, no sign up. Sample data.

Download the practice sheet (.xlsx, 10 KB)

Watch it in 23 seconds

Templates with the math already done

Rather skip the formulas? These templates come with every formula built and checked, plus a filled-in sample.

Teaching this to a class or team?

Get one tip like this a month

A free email from VARS Digital with one Excel or Google Sheets fix, tested in both apps. No spam, unsubscribe any time.

By signing up you agree that VARS Digital, 10151 240 Street, Maple Ridge, BC V2W 0G9, Canada (inquiries@varsdigital.app) may email you its newsletter: Excel and Google Sheets tips, updates and news about our templates and lessons. We send a confirmation email first, and nothing else goes out until you click it. Every email has an unsubscribe link, and you can leave any time. Details in our store policies.

More how-tos