+ Reply to Thread
Results 1 to 6 of 6

Calculate total employee attendance

  1. #1
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Calculate total employee attendance

    Hello,

    I would like to calculate the total attendance of employees and the daily punch in and out time as well. I am encountering two issues: the first is when an employee punches in i.e. today and punches out a few hours after midnight the following day. I tried formatting the result in various ways but can't get the correct result. Also would it be possible to automate the process somehow? You can see the exact format in the attachment below.

    Thank you for looking
    Attached Files Attached Files

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,508

    Re: Calculate total employee attendance

    Add the date and time together before subtracting:

    =(B7+C7)-(B6+C6)


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,508

    Re: Calculate total employee attendance

    Or better:

    Cell F6: =IF(D6="OUT",(B6+C6)-(B5+C5),"")

    and copy formula down.


    Regards, TMS

  4. #4
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Re: Calculate total employee attendance

    Thank you very much! How does the adding of the date and time work? Can I read about it somewhere?

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,508

    Re: Calculate total employee attendance

    You're welcome. Thanks for the rep.

    A date is a number, the number of days from 01/01/1900. If you change the format of a date cell to general, you'll just see a number. Similarly, a time is also a number, a fraction of a 24 hour period. So, if you add a date and time you get a number with a decimal part. When you subtract a time, say, late today, from a time early tomorrow, you get a negative time ... which Excel isn't happy about. But, if you add the dates and times before the subtraction, you get a positive time value.

    Hope that helps.

    Regards, TMS

  6. #6
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Re: Calculate total employee attendance

    Thanks for the amazing explanation. Got it!

+ 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