How to Calculate Total Minutes Between Login and Logout Times in Excel
Question details
The user needs to compute the exact number of elapsed minutes between two specific time values (login and logout).

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Tracking employee working hours, shifts, or calculating the duration of specific tasks.
- Observed behavior
- The user wants to obtain an integer representing total minutes rather than a standard clock time format.
Ensure your login and logout data are properly recognized as Time formats in Excel (e.g., 10:51 AM) before applying calculation formulas.
Use the MOD Formula to Calculate Minutes
This is the most robust method for calculating time differences, as it automatically accounts for shifts that might cross over midnight into the next day.
Excel stores dates and times as decimal fractions, where one whole 24-hour day equals 1. Because there are 24 hours in a day and 60 minutes in an hour, multiplying a time fraction by 1,440 (24 x 60) accurately converts the fraction into total minutes.
Using the MOD function ensures that if a logout time is numerically smaller than a login time (like an overnight shift from 10:00 PM to 6:00 AM), the calculation still returns a positive, accurate duration.
Ensure your login time is in cell A2 and your logout time is in cell B2.
Select a blank cell, such as C2, and type the formula: =1440*MOD(B2-A2,1).
Right-click cell C2, select 'Format Cells', choose 'General' or 'Number' with zero decimal places, and click OK.
Click and drag the small square at the bottom-right corner of cell C2 down the column to apply this calculation to other employee records.

Basic Subtraction Formula (Same-Day Shifts Only)
A simpler formula if you are absolutely certain all work shifts start and end within the same calendar day.
Calculate Work Hours Seamlessly with WPS Spreadsheet
WPS Office provides a powerful, free alternative to Microsoft Excel. You can easily calculate time differences, apply the MOD function, and manage employee shifts with exactly the same formulas and interface you already know.
- 1. Open your timesheet: Launch WPS Spreadsheet and open your employee timesheet document.
- 2. Enter the time formula: Type =1440*MOD(B2-A2,1) in the duration cell to calculate the minutes.
- 3. Format and drag: Set the cell format to 'General' and drag the fill handle down to apply it to all employees.

Frequently Asked Questions
Why does my formula result show as 12:00 AM instead of a number?
This happens because Excel sometimes automatically inherits a Time format when time cells are referenced. Right-click the cell with the result, select 'Format Cells', and change the category to 'General' or 'Number' to reveal the actual minutes.
How do I calculate total hours instead of total minutes?
To calculate total hours, you multiply the time fraction by 24 (the number of hours in a day) instead of 1,440. The formula would be =24*MOD(B2-A2,1).
What if my cells contain both the date and the time?
If your cells include both the date and time (e.g., '10/24 10:51 AM'), you do not need the MOD function because the date value handles overnight changes naturally. Simply subtract the start time from the end time and multiply by 1440: =(B2-A2)*1440.
How can I calculate hours and minutes together, like '8 hrs 30 mins'?
You can subtract the start time from the end time using =B2-A2 (or =MOD(B2-A2,1) for overnight shifts). Then, right-click the cell, select 'Format Cells', go to 'Custom', and enter [h] "hrs" mm "mins" as the format code.




