+ Reply to Thread
Results 1 to 8 of 8

VBA to calculate half day/ full day as per time sheet

  1. #1
    Registered User
    Join Date
    05-05-2015
    Location
    india
    MS-Off Ver
    2010
    Posts
    20

    VBA to calculate half day/ full day as per time sheet

    Hi Friends,

    I need your help in the attached time sheet to calculate whether the employee is entitled for half day or full day salary. The rule is simple: Either he logs in after 1200 hrs or logs after 2100 hours or both, he is marked as half day, else full day.

    I would like conditional formatting for half day employee cells, name filled with red, and also copied to a new sheet.

    Attached is workbook for reference.
    Attached Files Attached Files

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,021

    Re: VBA to calculate half day/ full day as per time sheet

    The rule is simple: Either he logs in after 1200 hrs or logs after 2100 hours or both, he is marked as half day
    Do you have two shifts ? First: 12:00 to 21:00 .... Second: 21:00 - 6:00 next day ?

    Excel has a problem understanding time that spans into a new day (after 24:00 hrs).

    Let me know what your shifts are or is there only one shift ?
    Last edited by Logit; 12-04-2016 at 06:29 PM.

  3. #3
    Registered User
    Join Date
    05-05-2015
    Location
    india
    MS-Off Ver
    2010
    Posts
    20

    Re: VBA to calculate half day/ full day as per time sheet

    Thank you for the response. It's a retail outlet whose working window is 11am till 9pm. All in single shift

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,021

    Re: VBA to calculate half day/ full day as per time sheet

    Ok,thanks. I've been working on it this weekend. Should get back to you today with what you need.

  5. #5
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,021

    Re: VBA to calculate half day/ full day as per time sheet

    There may be some differences between this attachment and what you've been working on there. You are using Excel 2010 and I use 2007.

    If you have trouble getting this attachment to work, it may be necessary to copy the code into your version. If you have to do this PLEASE USE A COPY OF YOUR VERSION, NOT THE ORIGINAL. That way if anything goes wrong
    you won't lose the original file.

    The changes made to the workbook include :

    Column AM has Formulas and Conditional Formatting in various cells relating to the "In Time" and "Out Time"
    entries. The word ERR is placed above those cells as a visual indication.

    Column AP is a "helper column" in that the numbers contained in the cells are transferred to the Report Sheet
    when the Monthly Clocking Report is run.

    When an employee clocks in late or clocks out early, the cells in column AM will turn red and indicate how
    many times in the pay period they missed a timely time punch. Their name will also turn red. The numbers
    in those cells are automatically copied to the adjacent cell in Colum AP.

    At the end of the pay period you click the Report button. The report is generated from the data in the
    monthly Clock-In / Clock-Out Report to the Report Sheet.

    You can then print that sheet for filing - or - you can click the ADD LINE button to give blank lines for
    the following month's report.

    The two buttons on the Report Sheet are for adding additional lines to the spreadsheet. This way you can maintain a copy of all Clocking discrepancies. If this is your desire, be certain to use the ADD MULTI LINE button ... cuz there
    has to be enough empty rows (starting at row 3) for additional data to be transferred from the clock-in / clock-out sheet. If you don't move existing data down, the new data will over write the existing data.

    Experiment with the two buttons (Add Rows) to see how they function. The ADD MULTI LINE button works slightly different from the other.

    HTH
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    05-05-2015
    Location
    india
    MS-Off Ver
    2010
    Posts
    20

    Re: VBA to calculate half day/ full day as per time sheet

    Thanks, I just checked your reply on my mobile. Will run the code tomorrow at work and see. Anyways, thanks in advance for your time and pain. Will update shortly.
    Last edited by Avinashch; 12-06-2016 at 04:48 PM.

  7. #7
    Registered User
    Join Date
    05-05-2015
    Location
    india
    MS-Off Ver
    2010
    Posts
    20

    Re: VBA to calculate half day/ full day as per time sheet

    I Think this resolves. Thank you!

  8. #8
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,021

    Re: VBA to calculate half day/ full day as per time sheet

    You're Welcome ! Glad to help.

+ 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. Formula for Timesheet - Double Time, Time Half and normal Hours
    By Tracs13 in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 09-12-2017, 09:40 PM
  2. Replies: 5
    Last Post: 07-29-2016, 03:15 AM
  3. Time sheet that splits normal time and a half and double time
    By leewat in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-09-2016, 07:52 PM
  4. Formula to calculate half wins and half losses
    By chilli76 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-27-2014, 07:33 AM
  5. [SOLVED] First unit full price, each one after at half off
    By LaurenF in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-14-2014, 03:01 PM
  6. [SOLVED] Can time series be plotted as half solid, half dotted line?
    By Carol in forum Excel General
    Replies: 2
    Last Post: 08-15-2006, 03:20 PM
  7. Calculate time difference to the half hour
    By Ken Ivins in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 09-06-2005, 03: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