Home›Blog›Guides

Attendance Sheet with Time In and Time Out in Excel: Formulas

Build an attendance sheet with time in and time out in Excel: exact formulas for hours, night shifts, late minutes and overtime, plus a free template.

29 Nov 2026·7 min read

To build an attendance sheet with time in and time out in Excel, put the date, employee, time in, time out and break in columns, then calculate hours worked with =MOD(TimeOut-TimeIn,1)*24 minus the break, late minutes against your office start time, and overtime above a standard day. Below is every step with the exact formulas, including night shifts that end after midnight, and the errors that break most sheets.

If you would rather skip the build, our free attendance sheet for Excel already has all of this. But it helps to know how the formulas work, so you can fix a sheet when something looks wrong.

Step 1: set up the columns

Column Header What goes in Format
A Date The working day dd-mmm-yyyy
B Employee Name, typed the same way every time Text
C Time In Arrival, for example 9:05 AM h:mm AM/PM
D Time Out Departure, for example 6:10 PM h:mm AM/PM
E Break (min) Break in minutes, for example 60 Number
F Hours worked Formula Number, 2 decimals
G Late (min) Formula Number
H Overtime (h) Formula Number, 2 decimals
I Status Formula Text

Put headers in row 1 and start the data in row 2. Use Data, Data Validation, List for the Employee column so names are always spelled the same; the monthly totals depend on it.

Step 2: create three settings cells

On a sheet called Settings, type the office start time in B1 (9:00 AM), the grace period in minutes in B2 (15) and the standard working day in hours in B3 (8). Then name them: click B1, type OfficeStart in the Name Box to the left of the formula bar and press Enter. Do the same for B2 (Grace) and B3 (StdHours).

Named cells keep your formulas readable and stop them breaking when you copy them down. If you prefer, use absolute references such as Settings!$B$1 instead.

Step 3: calculate hours worked

In F2:

=IF(OR(C2="",D2=""),"",ROUND(MOD(D2-C2,1)*24-N(E2)/60,2))

  • D2-C2 is the time between in and out, as a fraction of a day.
  • MOD(…,1) fixes shifts that end after midnight. A shift from 9:00 PM to 6:00 AM gives a negative number, which Excel shows as ####. MOD turns it into the correct 9 hours.
  • *24 converts the fraction of a day into hours.
  • N(E2)/60 takes off the break in hours, and treats an empty break as zero.
  • ROUND(…,2) keeps two decimals, so 8 hours 5 minutes shows as 8.08.
  • The IF(OR(…)) wrapper leaves the cell empty until both times are typed.

Prefer hours as h:mm? Use =MOD(D2-C2,1)-N(E2)/1440 and format the cell as [h]:mm. Pick one style for the whole sheet; mixing decimals and h:mm causes payroll errors.

Step 4: calculate late minutes

For a day shift, this formula in G2 is enough:

=IF(C2="","",IF(ROUND((C2-OfficeStart)*1440,0)>Grace,ROUND((C2-OfficeStart)*1440,0),0))

*1440 turns the gap into minutes (there are 1,440 minutes in a day). An employee is late only when they arrive more than the grace minutes after the start time, and the late minutes are counted from the start time. ROUND matters: without it, someone arriving at exactly 9:15 can be marked late because of a tiny rounding error in how Excel stores time.

For a night shift, use the MOD version, so an arrival after midnight still counts:

=IF(C2="","",IF(AND(ROUND(MOD(C2-OfficeStart,1)*1440,0)<720,ROUND(MOD(C2-OfficeStart,1)*1440,0)>Grace),ROUND(MOD(C2-OfficeStart,1)*1440,0),0))

The <720 check treats anything more than 12 hours “late” as early. Without it, someone who arrives at 8:55 PM for a 9:00 PM shift would show as 1,435 minutes late.

If your policy counts late minutes only after the grace period, change the result part of the day-shift formula to ROUND((C2-OfficeStart)*1440,0)-Grace.

Let attendance mark itself.

Zealtrack takes the clock-in and clock-out from each computer, fills timesheets by itself and builds late and overtime reports with CSV export. Free for unlimited users, no credit card.

Start free or book a 30-minute demo

Step 5: calculate overtime

In H2:

=IF(F2="","",MAX(0,ROUND(F2-StdHours,2)))

This gives hours worked beyond the standard day, and zero for shorter days. If your overtime rule is weekly rather than daily, total the week first, for example =MAX(0,SUM(F2:F7)-48) for a 48-hour week; use the limit from your contract and local law. For how overtime is paid in Pakistan, our overtime calculator lists the rule for each province.

Step 6: add a status

In I2:

=IF(C2="","Absent",IF(G2>0,"Late","On time"))

A blank time in means absent, so only add rows for scheduled working days, or type “Leave” or “Off” over the formula on those days.

Step 7: monthly totals per employee

On a Summary sheet, put each employee’s name in column A, starting at A2. Then:

  • Days present: =COUNTIFS(Log!B:B,A2,Log!C:C,"<>")
  • Hours worked: =SUMIFS(Log!F:F,Log!B:B,A2)
  • Late days: =COUNTIFS(Log!B:B,A2,Log!G:G,">0")
  • Overtime hours: =SUMIFS(Log!H:H,Log!B:B,A2)

Here Log is the name of your daily sheet. To limit a total to one month when the log covers several, add date conditions: =SUMIFS(Log!F:F,Log!B:B,A2,Log!A:A,">="&DATE(2026,12,1),Log!A:A,"<"&DATE(2027,1,1)).

Example: an attendance sheet with time in and time out in Excel

Office start 9:00 AM, 15 minutes’ grace and an 8-hour day. The first three rows are the values our free sheet calculates for the same entries (it shows a dash instead of 0). The last row is a night team with a 9:00 PM start.

Date Employee Time In Time Out Break (min) Hours worked Late (min) Overtime (h) Status
01-Dec-2026 Ali Raza 9:05 AM 6:10 PM 60 8.08 0 0.08 On time
01-Dec-2026 Sana Khan 9:32 AM 6:00 PM 45 7.72 32 0 Late
01-Dec-2026 Ahmed Hassan 8:55 AM 7:30 PM 60 9.58 0 1.58 On time
01-Dec-2026 Bilal Ahmed (night) 9:20 PM 6:15 AM 30 8.42 20 0.42 Late

Common errors and how to fix them

  • #### in the hours column. A negative time, almost always a shift past midnight without MOD. Add MOD, or widen the column if the number is simply too long.
  • Weekly total shows 4:30 instead of 52:30. The cell is formatted as h:mm, which resets every 24 hours. Use the custom format [h]:mm.
  • Formulas return #VALUE! or zero. The times are text, often after pasting from a machine export. Check with =ISNUMBER(C2); if it says FALSE, convert with =TIMEVALUE(C2) or retype the times.
  • A 9-to-6 day shows 21 hours. “6:00” was typed without PM, so Excel read 6:00 AM. Type 6:00 PM or 18:00.
  • Breaks barely change the hours. The break was typed as 1:00 instead of 60. The formula expects minutes.
  • 8:30 paid as 8.30 hours. Eight and a half hours is 8.50 as a decimal. Multiply h:mm by 24 to convert.
  • Totals miss an employee. A name was typed differently (“Ali Raza” and “Ali Raza”). Use a drop-down list.

Skip the build: download the free sheet

Our free employee attendance sheet is an Excel file with four sheets plus instructions, free with no sign-up. Settings holds the company name, month, office start time, grace minutes, standard hours, weekly off days and up to 50 employees. The Daily Log has 500 rows where hours worked, late minutes, overtime and status calculate themselves. The Monthly Register is a P / A / L / H / O grid, and the Summary gives each employee’s month on one line. It also works in Google Sheets: choose File, Import, Upload.

When the sheet becomes the problem

A spreadsheet is only as good as the times typed into it. When typing times takes hours each month, or nobody trusts them, Zealtrack fills in time in and time out by itself from each employee’s Windows or macOS computer: the first activity of the day is the clock-in and the last is the clock-out. Late arrivals are marked against the office timing you set, and a “day starts at” setting keeps a night shift on one working day, with no MOD needed. Every report exports to CSV, so the numbers drop into a spreadsheet whenever you need them. It is free for unlimited employees; sign up and compare a week with your sheet.

Frequently asked questions

How do I calculate hours between time in and time out in Excel?

Subtract time in from time out and multiply by 24: =(D2-C2)*24. Use =MOD(D2-C2,1)*24 if any shift ends after midnight, and subtract the break in hours.

How do I calculate hours worked past midnight in Excel?

Wrap the subtraction in MOD: =MOD(D2-C2,1)*24. MOD adds a day when time out is earlier than time in, so 9:00 PM to 6:00 AM correctly gives 9 hours.

How do I calculate late minutes in Excel?

Subtract the office start time from time in and multiply by 1,440 to get minutes. Count it as late only when the result is more than your grace period, and round to whole minutes first.

Why does Excel show #### instead of hours?

Usually because the result is a negative time, which Excel cannot display. That happens when a shift ends after midnight; use MOD to fix it.

Done with typing times? Try Zealtrack free for unlimited employees, or book a 30-minute demo.

Track time without watching people.

Free for unlimited users. No credit card.

Start free Book a demo
Chat with us on WhatsAppPick the office nearest to you.Saudi Arabia+966 53 961 0354Pakistan+92 344 2928117