+ Reply to Thread
Results 1 to 8 of 8

Getting First In and Last out from a temp data

  1. #1
    Registered User
    Join Date
    04-30-2017
    Location
    Manila
    MS-Off Ver
    2013
    Posts
    3

    Getting First In and Last out from a temp data

    Hi everyone,

    I am in need of help developing a formula to get the first in and last out from a biometrics logs that I have, here below is a sample of the raw data that will provide me

    [CardNo] Name [Company] [Date] [Time] [Action] [ActionText]
    605 User1 Department 1 26/04/2016 1:21:20 PM 1 ENTER
    605 User1 Department 1 26/04/2016 1:22:36 PM 0 LEAVE
    28 User3 Department 1 26/04/2016 1:31:55 PM 1 ENTER
    34 User5 Department 1 26/04/2016 1:31:57 PM 1 ENTER
    605 User1 Department 1 26/04/2016 1:33:19 PM 1 ENTER
    601 User6 Department 1 26/04/2016 1:37:21 PM 1 ENTER
    605 User1 Department 1 26/04/2016 1:38:39 PM 0 LEAVE
    605 User1 Department 1 27/04/2016 1:40:10 PM 1 ENTER
    28 User3 Department 1 27/04/2016 1:43:17 PM 0 LEAVE
    1007 User8 Department 1 27/04/2016 1:45:34 PM 1 ENTER
    32 User4 Department 1 27/04/2016 1:46:32 PM 0 LEAVE
    28 User3 Department 1 27/04/2016 1:47:06 PM 1 ENTER
    1007 User8 Department 1 27/04/2016 1:49:50 PM 0 LEAVE
    1007 User8 Department 1 28/04/2016 1:49:58 PM 1 ENTER
    1007 User8 Department 1 28/04/2016 1:50:11 PM 1 ENTER
    1007 User8 Department 1 28/04/2016 1:55:10 PM 0 LEAVE
    605 User1 Department 1 28/04/2016 2:02:44 PM 0 LEAVE
    605 User1 Department 1 28/04/2016 2:06:43 PM 0 LEAVE
    6 User2 Department 1 28/04/2016 2:23:00 PM 0 LEAVE
    6 User2 Department 1 28/04/2016 2:24:28 PM 1 ENTER
    605 User1 Department 1 29/04/2016 2:25:21 PM 0 LEAVE
    605 User1 Department 1 29/04/2016 2:27:42 PM 1 ENTER
    999 User7 Department 1 29/04/2016 2:37:40 PM 0 LEAVE
    34 User5 Department 1 29/04/2016 2:39:28 PM 0 LEAVE
    601 User6 Department 1 29/04/2016 2:41:07 PM 0 LEAVE
    28 User3 Department 1 29/04/2016 2:42:19 PM 0 LEAVE
    34 User5 Department 1 29/04/2016 2:42:48 PM 1 ENTER


    I was hoping to get a good report out of this data

    From how it looks above to

    Date Date
    Card Number User Department Time In Time Out Time In Time Out


    Thanks in advance to those who 'll reply.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Getting First In and Last out from a temp data

    Concatenate the date and time, if they're separate and then get the large 1 for latest and the small 1 for earliest
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Getting First In and Last out from a temp data

    Another way is, insert a pivot table, drag the Name field into the Rows area and Concatenated Date & Time field twice into the Values area and change Value Field Settings to summarize by Min for one and Max for other.
    Last edited by sktneer; 06-30-2017 at 08:40 PM. Reason: Typo
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  4. #4
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Getting First In and Last out from a temp data

    If my solution worked (or not) please let me know. If your question is answered then please remember to mark it solved

    Computers are like air conditioners. They work fine until you start opening windows. ~Author Unknown

  5. #5
    Registered User
    Join Date
    04-30-2017
    Location
    Manila
    MS-Off Ver
    2013
    Posts
    3

    Re: Getting First In and Last out from a temp data

    Hi,

    Thanks for the response, but unfortunately, the data seems to get a 0 value after changing the settings to MIN/MAX

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,703

    Re: Getting First In and Last out from a temp data

    Hello Skipper23, and welcome to Excel Forum.
    Please identify any cross posting in the future.
    Attached is a pivot table based solution, based on sktneer's post, which also includes a few added formulas on sheet 1.
    The first formula produces a column filled with date & time combinations for time 'In': =IF($F2=1,$D2+$E2,"")
    The second formula produces a column filled with date & time combinations for time 'Out': =IF($F2=0,$D2+$E2,"")
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  7. #7
    Registered User
    Join Date
    04-30-2017
    Location
    Manila
    MS-Off Ver
    2013
    Posts
    3

    Re: Getting First In and Last out from a temp data

    Thanks for this JeteMc. I will take note of the cross posting. I was actually in need of help for this.

    Though, is still possible to get the first in and last out for a specific day and specific user.

    In the sheet I've provided, As I see, what if I have multiple Enter for just 1 day, and vice versa for the Leave, what would be my identifier for that?

    I can see your formula to come up with Less than or More than identifier, if I am correct.

    As well, if the user comes in at night, probably around 20:00 and left at 06:00, it will jump the next day. How will my formula for this be?

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,703

    Re: Getting First In and Last out from a temp data

    To get the specific date you could use the PivotTable Tools tab and insert a slicer with Date selected. As to the specific user, use the filter button on the 'Name' column header, cell B3. If I understand the question about an entry at 8:00 PM and leaving at 6:00 AM, you could select two consecutive dates from the slicer.
    As to the question about multiple Entries/Leaves during a day, if you would manually show what you want the output to look like, perhaps someone will know how to do what you want. To upload a sample spreadsheet click on the GO ADVANCED button below the Quick Reply window and then scroll down to Manage Attachments to open the upload window.
    Let us know if you have any questions.Attach a sample workbook.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Pulling specific data from a specific sheet, loading to a temp sheet, for forwarding.
    By Fawkes_ in forum Excel Programming / VBA / Macros
    Replies: 39
    Last Post: 02-17-2017, 11:10 AM
  2. Copy specific data from a sheet to temp sheet and copy temp sheet to new workbook
    By ANUARORA in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-18-2015, 11:58 AM
  3. Replies: 1
    Last Post: 01-12-2015, 08:07 PM
  4. how to copy specific data from a sheet to temp sheet and copy temp sheet toa new workbook?
    By NatashaKapoor in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-18-2014, 09:01 AM
  5. Replies: 2
    Last Post: 10-24-2013, 10:11 AM
  6. Macro which saves data from temp worksheet to customers worksheet?
    By lala121 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-17-2013, 09:12 AM
  7. Replies: 2
    Last Post: 01-26-2006, 04:20 AM

Tags for this Thread

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