+ Reply to Thread
Results 1 to 20 of 20

Finding the First Login and Last Logout Times of Employees

  1. #1
    Forum Contributor
    Join Date
    12-07-2004
    Posts
    596

    Finding the First Login and Last Logout Times of Employees

    Problem:

    Range cells A2:C10 contains the IDs and login and logout times of various employees.
    Each person can log in and out several times a day.
    We want to find the first time each employee logged in and the last time they logged out.

    Solution:

    To find the first login time for each unique ID in A13:A16, use the MAX function as shown in the following Array formula:
    {=1/MAX((A13=$A$2:$A$10)*($B$2:$B$10

    To find the last logout time for each unique ID in D13:D16, use the MAX function as shown in the following Array formula:
    {=MAX(($A$2:$A$10=D13)*($D$2:$D$10))}

    To apply Array formula:
    Select the cell, press

  2. #2
    Registered User
    Join Date
    03-27-2017
    Location
    Manila, Philippines
    MS-Off Ver
    2010
    Posts
    64

    Re: Finding the First Login and Last Logout Times of Employees

    My name is Dy. I maybe posting my question to the wrong thread please forgive me. I just find your post relative to my concern.

    I have a "Running” employee logs - meaning both login and logout time are both in one column but on the next column, it indicates whether it is "In" or "Out".

    My requirement is to find the FIRST login (Column I) and LAST logout (Column J) considering both employees working night shift (ex.10PM-7AM) - need to capture first login during the night say 3/7/2017 and last logout in the morning of 3/8/2017 AND a regular day shift (ex.3AM-12PM) - same date (3/8/2017)

    Please see attached sample logs

    Thank you all for your help!
    Attached Files Attached Files

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Finding the First Login and Last Logout Times of Employees

    Hey exceltip and dy,

    I think you can do this problem using a Pivot Table and showing a column of Min and another of Max. If you group by date the answers appear. No formulas needed. See the attached.

    First Time In and Last Time Out.xlsb
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Registered User
    Join Date
    03-27-2017
    Location
    Manila, Philippines
    MS-Off Ver
    2010
    Posts
    64

    Re: Finding the First Login and Last Logout Times of Employees

    Hi MarvinP,

    Thank you for your inputs. Really great idea! This works perfectly fine for employees working in day shift where only one date is involved.

    For night shift employees, that's where I find trouble.

    I have attached the file and highlighted parts of Emp5 - this employee works night shift. He usually login at around 11PM and normally logout 9AM in the morning. The pivot table only captures the first login of Emp5 after 12midnight which is wrong because the FIRST login actually happened at around 11PM

    Thanks for your help

    Dy.
    Attached Files Attached Files

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Finding the First Login and Last Logout Times of Employees

    Hey,

    How about something like creating a new column for the night shifters? You would subtract 1 from the day, only for the night shift people. Then reverse the Min and Max? You simply (might be hard) have to get the in and out to show the same day!

  6. #6
    Registered User
    Join Date
    03-27-2017
    Location
    Manila, Philippines
    MS-Off Ver
    2010
    Posts
    64

    Re: Finding the First Login and Last Logout Times of Employees

    Thank you Marvin,

    That would work. The only problem is that the logs contain the entire employee records..there were employees working on a flexible schedule starting at night and ends in the morning (it could be 9PM-6AM, 10PM-7AM, 11PM-8AM, etc) - a mixed day and night shift in one file - this means I have no control of who is changing/adjusting schedule from time to time.

    The goal is to capture the FIRST login and LAST logout regardless of the shift schedule.

    Hoping there are other ways?

  7. #7
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Finding the First Login and Last Logout Times of Employees

    You need to somehow tag those night shift check ins and outs. Without doing that you don't have enough information to do the problem. You might already know this.

  8. #8
    Registered User
    Join Date
    03-27-2017
    Location
    Manila, Philippines
    MS-Off Ver
    2010
    Posts
    64

    Re: Finding the First Login and Last Logout Times of Employees

    Cool, Thanks for your help!

  9. #9
    Registered User
    Join Date
    03-27-2017
    Location
    Manila, Philippines
    MS-Off Ver
    2010
    Posts
    64

    Re: Finding the First Login and Last Logout Times of Employees

    Quote Originally Posted by dy137 View Post
    How about something like creating a new column for the night shifters? You would subtract 1 from the day, only for the night shift people. Then reverse the Min and Max?
    Hi Sir, I will consider this...not sure if I get the idea here, can you please show me how to calculate?

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Finding the First Login and Last Logout Times of Employees

    Perhaps you guys missed that you are posting on a thread that is almost 12 years old?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  11. #11
    Registered User
    Join Date
    03-27-2017
    Location
    Manila, Philippines
    MS-Off Ver
    2010
    Posts
    64

    Re: Finding the First Login and Last Logout Times of Employees

    Hello Admin,

    Apologies if it violates the forum rule, I was researching for similar questions, taking chances to get a response and finally got lucky with MarvinP answers..

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Finding the First Login and Last Logout Times of Employees

    I let it go because the OP actually had no responses to their question

  13. #13
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Finding the First Login and Last Logout Times of Employees

    I certainly missed that small point! Thanks for pointing that out. I was worried we hijacked the OP's thread, but now I see I shouldn't worry too much.

  14. #14
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Finding the First Login and Last Logout Times of Employees

    We all miss stuff now and then, no problem, Marvin

  15. #15
    Registered User
    Join Date
    04-12-2017
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    1

    Re: Finding the First Login and Last Logout Times of Employees

    You are too good, i am also stuck in this option but didnt find this useful until i checked the cell format..
    when i extracted this sheet from the attendance system it was in text and after seeing yours i got idea to multiply all times with 1 to convert it to Custom format.. :-) thanks @marvin

  16. #16
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Finding the First Login and Last Logout Times of Employees

    sbhadki welcome to the forum and thanks for the input

  17. #17
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Finding the First Login and Last Logout Times of Employees

    Hi sbhadki and welcome to the forum,

    When you said you multiplied by 1, you could also have added zero to get those text to numbers.

    I don't know if you did it using Paste Special using Add like this site shows.
    http://www.techrepublic.com/blog/mic...ting-in-excel/

  18. #18
    Registered User
    Join Date
    02-04-2018
    Location
    Vietnam
    MS-Off Ver
    Office 2016
    Posts
    3

    Re: Finding the First Login and Last Logout Times of Employees

    New topic has been create on the link : https://www.excelforum.com/excel-for...ml#post4836151

    Thanks protonLeah !
    Attached Images Attached Images  
    Last edited by ngthanhluan; 02-05-2018 at 12:29 AM. Reason: Follow Forum policy to create new theard

  19. #19
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: Finding the First Login and Last Logout Times of Employees

    ngthanhluan,

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    Ben Van Johnson

  20. #20
    Registered User
    Join Date
    12-20-2017
    Location
    New York
    MS-Off Ver
    2016
    Posts
    6

    Re: Finding the First Login and Last Logout Times of Employees

    We use punch card option in my office. It tracks all Turnstile IN as well as Turnstile Out. So it is easy to find it out.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1