+ Reply to Thread
Results 1 to 17 of 17

Create time sheet to automatically calculate hrs worked

  1. #1
    Registered User
    Join Date
    03-28-2015
    Location
    us
    MS-Off Ver
    Office365
    Posts
    46

    Create time sheet to automatically calculate hrs worked

    I am trying to create a time sheet for my company that automatically calculates hrs worked.

    So far I have where you can log a time in and a time out and it calculate your hours.
    I also have it to where you can log a lunch out and a lunch in and it subtract the correct amount for total hrs that day.
    I have it to where if you dont log a time in or time out it will return a blank.

    This is where I am having problems, I want it to return a blank if there is a lunch time out but not a lunch time in OR return a blank if there is a lunch time in but not a lunch time out.

    Here is my current formula:

    =IF(OR(ISBLANK(I10),ISBLANK(L10)),"",(IF(OR(ISBLANK(J10),ISBLANK(K10)),(((L10-I10)-INT(L10-I10))*24),(((J10-I10)+(L10-K10))-INT((J10-I10)+(L10-K10)))*24)))

    Here is a screenshot:
    Excel Timesheet ScreenShot.jpg

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,483

    Re: Help with time sheet formula Please

    Try changing the opening section to this:

    IF(OR(COUNT(I10:L10)<2,COUNT(J10:K10)<2), ...)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    03-28-2015
    Location
    us
    MS-Off Ver
    Office365
    Posts
    46

    Re: Help with time sheet formula Please

    Quote Originally Posted by AliGW View Post
    Try changing the opening section to this:

    IF(OR(COUNT(I10:L10)<2,COUNT(J10:K10)<2), ...)

    Thank you that worked but now if there wasnt a lunch taken (lunch out and in both blank) then it returns a blank. I still need it to calculate the time in and time out if there wasnt a lunch taken.

    Thank you very much!

    Josh

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,483

    Re: Help with time sheet formula Please

    Will you please attach a sample Excel workbook? We are not able to work with or manipulate a picture of one and nobody wants to have to recreate your data from scratch.

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired results are also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.

  5. #5
    Registered User
    Join Date
    03-28-2015
    Location
    us
    MS-Off Ver
    Office365
    Posts
    46

    Re: Help with time sheet formula Please

    Here it is:
    Attached Files Attached Files
    Last edited by AliGW; 03-08-2018 at 02:10 AM. Reason: Unnecessary quotation removed.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,483

    Re: Help with time sheet formula Please

    In your file, what are your expected results for the third line (not possible?) and the fourth line, please?

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,483

    Re: Help with time sheet formula Please

    Give this a try:

    =IF(OR(J9="",K9=""),((L9-I9)-INT(L9-I9))*24,(((J9-I9)+(L9-K9))-INT((J9-I9)+(L9-K9)))*24)

  8. #8
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2021
    Posts
    5,931

    Re: Help with time sheet formula Please

    Try this ...

    =(L9-I9-IF(COUNT(J9:K9)=2,K9-J9,0))*24

    Change 0 to the number you want

  9. #9
    Registered User
    Join Date
    03-28-2015
    Location
    us
    MS-Off Ver
    Office365
    Posts
    46

    Re: Help with time sheet formula Please

    Quote Originally Posted by AliGW View Post
    In your file, what are your expected results for the third line (not possible?) and the fourth line, please?
    To return a blank in Q11
    To return a blank in Q12

  10. #10
    Registered User
    Join Date
    03-28-2015
    Location
    us
    MS-Off Ver
    Office365
    Posts
    46

    Re: Help with time sheet formula Please

    Quote Originally Posted by AliGW View Post
    Give this a try:

    =IF(OR(J9="",K9=""),((L9-I9)-INT(L9-I9))*24,(((J9-I9)+(L9-K9))-INT((J9-I9)+(L9-K9)))*24)


    Quote Originally Posted by Phuocam View Post
    Try this ...

    =(L9-I9-IF(COUNT(J9:K9)=2,K9-J9,0))*24

    Change 0 to the number you want
    I couldnt get either of these to work

    Thank very much for help me with this!

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,483

    Re: Help with time sheet formula Please

    Mine works in your workbook ... So what exactly do you mean?

  12. #12
    Registered User
    Join Date
    03-28-2015
    Location
    us
    MS-Off Ver
    Office365
    Posts
    46
    Quote Originally Posted by AliGW View Post
    Mine works in your workbook ... So what exactly do you mean?
    So when I use that formula when I put a time in it displays a 0 in the total for that day. I want it to display blank ("") until there is a time out also.

    Also I want it to display a blank ("") if there is a time in, lunch out, a blank cell, time out OR time in, blank cell, lunch in, time out.

    This is confusing but idk how to explain it better, tonight when I go home I can label a mock up of my results in red if that would help?

    Josh

  13. #13
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2021
    Posts
    5,931

    Re: Help with time sheet formula Please

    Haha! :

    =IF(COUNT(J9:K9)=1,"",(L9+J9-K9-I9)*24)

  14. #14
    Registered User
    Join Date
    03-28-2015
    Location
    us
    MS-Off Ver
    Office365
    Posts
    46

    Re: Help with time sheet formula Please

    Quote Originally Posted by Phuocam View Post
    Haha! :

    =IF(COUNT(J9:K9)=1,"",(L9+J9-K9-I9)*24)
    Thank you very much!! This is almost excactly what I am looking for. Is there anyway to make it not display a zero when everything is blank and is there away it wont show a negative number when I input the first time?

    Josh

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,483

    Re: Create time sheet to automatically calculate hrs worked

    Try this:

    =IF(COUNT(J9:K9)<=1,"",if((L9+J9-K9-I9)*24<=0,"",(L9+J9-K9-I9)*24))

  16. #16
    Registered User
    Join Date
    03-28-2015
    Location
    us
    MS-Off Ver
    Office365
    Posts
    46

    Re: Create time sheet to automatically calculate hrs worked

    Quote Originally Posted by AliGW View Post
    Try this:

    =IF(COUNT(J9:K9)<=1,"",if((L9+J9-K9-I9)*24<=0,"",(L9+J9-K9-I9)*24))
    Worked perfect , thank you so much for all the help!!

    Josh

  17. #17
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,483

    Re: Create time sheet to automatically calculate hrs worked

    You're welcome!

+ 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. Replies: 7
    Last Post: 04-25-2020, 03:23 AM
  2. [SOLVED] Need help in my Time Sheet - Count if 9hrs worked then calculate as 1 day
    By vbhupeshkumar in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-29-2017, 09:52 AM
  3. [SOLVED] [SOLVED] Calculate time worked inside Regular Hours and Over Time
    By myxamhatosis in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-07-2015, 09:16 PM
  4. Trying to create a time sheet to calculate my regular time/ overtime
    By Chichirod in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-02-2015, 09:18 AM
  5. Replies: 3
    Last Post: 01-20-2012, 01:35 PM
  6. [SOLVED] How do I automatically calculate dollars earned with time worked?
    By Brian Jacobson in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-09-2006, 08:15 AM
  7. how do I create a spread sheet to automatically calculate when I
    By wbinfo in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 09-28-2005, 04:05 PM

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