+ Reply to Thread
Results 1 to 12 of 12

Calculate total clocked In minutes in a given hour

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Calculate total clocked In minutes in a given hour

    Hello:

    Please refer to attached sheet.

    I will be ok with either VB Macro or Formula to perform this task.

    I have clockIn-ClockOut information for employees in row 2 thru 16

    I want to use this data and separate out to see how many minutes are employees clocked in a given hour.
    For example,
    on 7/1/2013,
    Angela Clockin at 954 and Clocked Out at 1403
    Tomas Clockin at 1003 and Clocked Out at 1132

    Between
    901-1000 the total minutes would be 6
    1001-1100 the total minutes worked would be 60+57 (60 min for Angela and 57 Min for Tomas)
    1101-1200 the total minutes worked would be 60+32 (60 min for Angela and 32 Min for Tomas)
    1201-1300 the total minutes worked would be 60 (60 min for Angela)
    1301-1400 the total minutes worked would be 60 (60 min for Angela)
    1401-1403 the total minutes worked would be 3 (3 min for Angela)


    I have manually calculated minutes for each hour and entered in column D Cell D20:D25

    I hope I have explained very clearly.

    Please let me know if you any questions.

    Thank you

    Riz Momin
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: Calculate total clocked In minutes in a given hour

    Hi,

    Rheck the report sheet in the attached workbook: TimeDifference.xlsm
    Note: report is created by button click on first sheet, the chart in the report is added manually
    You can adapt the time range to check in the code, e.g. 0:00 - 24:00 or, like implemented, 9:00 - 24:00 or whatever you need

    Code:
    Please Login or Register  to view this content.
    Please use [CODE]-TAGS
    When your problem is solved mark the thread SOLVED
    If an answer has helped you please click to give reputation
    Read the FORUM RULES

  3. #3
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Calculate total clocked In minutes in a given hour

    Hi tehneXus or Any exceler:

    Thank you so much for your help.
    This code work great for me.
    However i like to see if you can or someone can help me make small change in the code so that the result does not in separate "Result" sheet but goes in the same "Sheet1" in cell D20:D34, H20:H34, L20:L34 and so on.
    Please refer to earlier attached excel file "Book5.xls

    Thank you so much for help.

    Riz Momin

  4. #4
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: Calculate total clocked In minutes in a given hour

    Hi,

    changes as required, also solved a bug where a person logged in and out in the same hour. Note, if the start time is smaller or equal the end time "#Error" will be inserted instead of the day name in the header and the corresponding date will not be calculated till the end: TimeDifference 2.0.xlsm
    Good night
    Code:
    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Calculate total clocked In minutes in a given hour

    Hi :

    Please refer to attached sheet.
    Your code works great but still need some modification so that it will work with my existing excel file.

    The purpose of this is to calculate the payroll for each hour.

    Please help change the code to accomplish following:

    1.Employee data starts in cell O45
    2.Time Range start in cell J609:K621 and change range from 10am till 11pm instead 9am till 12pm
    3.Now I need to multiply the number of minutes by .125 ( $7.50/hour)
    4.Calculated (minutes*0.125) for each hour to be pasted in cell O609:O621, S609:S621, and so on.
    5. I see one bug, every time you run the macro, it creates new data. It needs to overwite in the same cell.

    I hope this is clear explanation.
    Please let me know if any questions.

    Thank you for all your help.

    Riz Momin
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: Calculate total clocked In minutes in a given hour

    Hi,

    1. How to find out where it ends?
    2. done
    3 + 4. done with formula
    5. It's not a bug, it's a feature ! ... done (hardcoded)

    TimeDifference 2.1.xlsm

  7. #7
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Calculate total clocked In minutes in a given hour

    Hello:

    The code works but still need little tweaking.

    1. Instead of Range starting in J609, please start at I609.( so now you have time range in Cell I609:J621)
    2. Start # of Minutes in N609 instead of M609 and so on..
    Leave column K,L and M blank since i am using those columns to add cumalative for all days.
    3. There seems to be bug in minute calc....if you see your attached sheet,
    Calculated minutes in column M,Q row 609 onward is wrong.
    Please check and let me know if any questions.
    4. Date and Day can start in cell
    O608 and P608
    S608 and T608 and onwards
    5. Your question was where does data ends:
    Data will be O48:EG78
    Data for a particular date will end when cell in employee column is blank.

    Once again, thank you so much for your great help.

    PLEASE REFER TO EXCEL FILE ATTACHED IN NEXT REPLY.

    Riz Momin
    Attached Files Attached Files
    Last edited by rizmomin; 07-07-2013 at 10:46 AM.

  8. #8
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Calculate total clocked In minutes in a given hour

    Hi :

    Please refer to ATTACHED EXCEL FILE.
    Go to Sheet1.
    There is error in minute calculation with the new code.
    Result from new code is showing in row 609 thru 621 Column M onward.

    Compare this result with previous code which was calculating minutes correctly (Result in row 626 onward)

    Please LET ME KNOW IF ANY QEUSTIONS.

    Thank you

    Riz Momin
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: Calculate total clocked In minutes in a given hour

    Hi,

    1. + 2. + 4. Output range as required
    3. Calculation bug found and fixed
    4. Input range is still hard-coded. This means if you change the location of the input strange things will happen. There is no fast way to find out the entire data range, mainly because of the blank columns between the data and because there is data below the input.


    try TimeDifference 2.2.xlsm

    code
    Please Login or Register  to view this content.

  10. #10
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Calculate total clocked In minutes in a given hour

    Hi tehNexus:

    Once again thank you for your help.
    I have made small modification in the code to make it work with my sheet, please refer to attached sheet. (i have right now got at row 66 but i will change later to go to row 608)
    Looks like i got it, however I see 2 problems as of right now.
    Please use the code with my modification and help me correct following issues.

    1. I will have other data in Column P,Q,T,U,X,Y and so on, so when running the macro, i want to
    make sure that these data's are not deleted. When we run macro, need to delete only minutes and $ data in column N,O,R,S, and so on.
    2. Need 2 digit in $ column O,S,W and so on with $ sign.
    3. I do not want to change the width of the columns, please keep column width same as original file.
    4. Date is coming as dd.mm.yyyy and this needs to be mm/dd/yyyy
    Please let me know if any questions.

    Thank you

    Riz Momin
    Attached Files Attached Files

  11. #11
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: Calculate total clocked In minutes in a given hour

    Hi,

    1. Existing data and new calculated will be merged in the paste area according to the following rule: Data will only be kept if the calculation array, holding all values/headers/times is empty for this specific cell.
    2. Applied accounting numberformat ("_($* #,##0.00_);_($* (#,##0.00);_($* ""-""??_);_(@_)") with 2 decimals. If you want to change this record a macro where you assign a numberformat to a cell and replace the string with the one I implemented.
    3. removed from code
    4. Changed to "mm/dd/yyyy" using numberformat "mm\/dd\/yyyy"

    TimeDifference 2.3.xlsm

    Code in attachment, will post into forum when final.

  12. #12
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Calculate total clocked In minutes in a given hour

    Hi tennexus:

    It looks like this will work great for me.
    I think i have ironed out all issues and seems to work.
    I will keep this tread open for right now and will close as SOLVE once I test it thoroughly.

    Once again thank you so much for your kind generous fast help and will be in contact with you if needed.

    Riz Momin

+ 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