Finding the First Login and Last Logout Times of Employees

In this article, you’ll learn how to find the first login and last logout times of employees by using Microsoft Excel functions. To solve this query, we use MAX function for both.

Let’s take an example,

We have data which contain IDS, Login and logout time details of various employees. Each employee can login and log out several times a day. We want to find the first time each employee logged in and the last time they logged out.

image 1


To return maximum login time, follow below given steps:-

  • Enter the formula in cell B19
  • =1/MAX((A19=$A$8:$A$16)*($B$8:$B$16<>0)*(1/$B$8:$B$16))

image 2


Note: - This is an array formula.

  • Press Ctrl+Shift+Enter

image 3


  • Copy the same formula in cell B20:B21

image 4


Now, we will calculate Log out time. Follow below given steps:-

  • Enter the formula in cell E19
  • =MAX(($A$8:$A$16=D19)*($C$8:$C$16))

image 5


  • Press Ctrl+Shift+Enter

image 6


  • Copy the formula in cell E20:E21

image 7


You can see in the above image that we have used MAX function to get the minimum login time and, to get the maximum log out time, we have used MAX function.

In this way, we can find the first login and last logout times for each employee by using Microsoft Excel function.


image 48


If you liked our blogs, share it with your friends on Facebook. And also you can follow us on Twitter and Facebook.

We would love to hear from you, do let us know how we can improve, complement or innovate our work and make it better for you. Write us at



Leave a Reply to Kritymoy Boroowa Cancel reply

Your email address will not be published. Required fields are marked *

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.