Results 1 to 10 of 29

Thread: Code Required to calculate number of days worked, normal overtime and holiday overtime

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    Jan 2017
    Posts
    9
    Rep Power
    0
    Dear Nelson,

    The code working fine , but have two problems 1)It calculates the number of days worked as 30 even if the person absent for one or two days

    2)I use column K for remarks which you are currently using to identify the days

    Sample attached

    Thanks,

    Nelson

    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://eileenslounge.com/viewtopic.php?p=244184#p244184
    https://eileenslounge.com/viewtopic.php?p=246586#p246586
    https://eileenslounge.com/viewtopic.php?p=246112#p246112
    https://eileenslounge.com/viewtopic.php?p=246112#p246112
    https://eileenslounge.com/viewtopic.php?p=245761#p245761
    https://eileenslounge.com/viewtopic.php?p=245722#p245722
    https://eileenslounge.com/viewtopic.php?p=245616#p245616
    https://eileenslounge.com/viewtopic.php?p=247043#p247043
    https://www.excelfox.com/forum/showthread.php/2307-VBA-Range-Sort-with-arrays-Alternative-for-simple-use
    https://eileenslounge.com/viewtopic.php?p=245238#p245238
    https://eileenslounge.com/viewtopic.php?p=245131#p245131
    https://eileenslounge.com/viewtopic.php?f=18&t=31638
    https://eileenslounge.com/viewtopic.php?p=244579#p244579
    https://eileenslounge.com/viewtopic.php?p=244648#p244648
    https://eileenslounge.com/viewtopic.php?p=244647#p244647
    https://eileenslounge.com/viewtopic.php?p=244577#p244577
    https://eileenslounge.com/viewtopic.php?p=245201#p245201
    https://eileenslounge.com/viewtopic.php?p=243975#p243975
    https://eileenslounge.com/viewtopic.php?p=243884#p243884
    https://eileenslounge.com/viewtopic.php?p=242439#p242439
    https://eileenslounge.com/viewtopic.php?p=243595#p243595
    https://eileenslounge.com/viewtopic.php?p=243589#p243589
    https://eileenslounge.com/viewtopic.php?p=243589#p243589
    https://eileenslounge.com/viewtopic.php?p=243002#p243002
    https://www.eileenslounge.com/viewtopic.php?p=242761#p242761
    https://eileenslounge.com/viewtopic.php?p=242459#p242459
    https://eileenslounge.com/viewtopic.php?p=242054#p242054
    https://eileenslounge.com/viewtopic.php?p=241404#p241404
    https://eileenslounge.com/viewtopic.php?p=229145#p229145
    https://eileenslounge.com/viewtopic.php?p=228710#p228710
    https://eileenslounge.com/viewtopic.php?p=226938#p226938
    https://eileenslounge.com/viewtopic.php?f=18&t=28885
    https://eileenslounge.com/viewtopic.php?p=222689#p222689
    https://eileenslounge.com/viewtopic.php?p=221622#p221622
    https://eileenslounge.com/viewtopic.php?f=27&t=22512
    https://eileenslounge.com/viewtopic.php?f=26&t=26183
    https://eileenslounge.com/viewtopic.php?f=26&t=26030
    https://eileenslounge.com/viewtopic.php?p=202322#p202322
    https://www.excelforum.com/word-formatting-and-general/1174522-finding-a-particular-word-phrase-in-word.html#post4604396
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Attached Files Attached Files
    Last edited by DocAElstein; 04-16-2024 at 06:43 PM.

  2. #2
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,316
    Rep Power
    10
    Quote Originally Posted by nelsondavid View Post
    The code working fine , but have two problems 1)It calculates the number of days worked as 30 even if the person absent for one or two days...
    Hi Nelson
    I have 5 questions ( _1a) 1b) 2a) 2b) 3) ) for you:
    _1) you told me that days are always 30 ??
    _1a) How do you now want Days calculated? ?????

    ( This is a new requirement I expect? Your original Before had no entries in column
    _1b) Is the requirement for taking into account absence new? ( or did you forget it originally) ?? )



    _2a) Which code are you using ?????
    ( You have 2
    Quote Originally Posted by DocAElstein View Post
    .......
    P.s.
    We have given you 2 codes
    From Alan
    Post #19 here: http://www.excelfox.com/forum/showth...age2#post10066

    From Alan and Admin
    Post #20 here: http://www.excelfox.com/forum/showth...age2#post10072

    Which are you using? Which do you prefer?? ????
    _2b) Which do you prefer?? ????



    -3) Are you sure that you do not require a header row ???
    Do you require a header row as in your first post here: File Sample2.xlxs http://www.excelfox.com/forum/showth...0058#post10058

    Header.jpg http://imgur.com/1Dvfv6N
    Header.JPG




    Alan
    Last edited by DocAElstein; 02-06-2017 at 11:24 PM.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

  3. #3
    Junior Member
    Join Date
    Jan 2017
    Posts
    9
    Rep Power
    0
    Dear Alan,

    Yes i actually forget to tell you about the absent days.What i mean "Every month we consider of 30 days , if the month is of 30 or 31 or like 28 days Feb all these months we take it as 30 days only.
    Total no. of days is the no. of days the person worked plus the holidays(holiday is deducted if the person does not come the day before and after the holiday)

    Header row not required

    Have attached sample files and the code am using now

    thanks,

    Nelson
    Attached Files Attached Files
    Last edited by nelsondavid; 02-07-2017 at 07:59 AM.

  4. #4
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,316
    Rep Power
    10
    Hi Nelson,
    So I assume you want to use the code that puts formulas in and adds a help column??? ( The second code , Sub IJAdjustKAddTotalAllWorksheet() )
    ( I see you have changed the row of the cells used to display the output to 34 )


    So possibly we can use column L for the help column ?

    _....................


    In your after file, ( "File 2 After.xlsx" ) , you have given 26 Working days for Worksheet “121”:
    Using Excel 2007 32 bit
    Row\Col
    B
    C
    34
    TOTAL NO. OF DAYS -----> 26
    Worksheet: 121


    But this is your before, ( "File 1 Before.xlsx" ):
    Using Excel 2007 32 bit
    Row\Col
    E
    F
    G
    1
    21.Dec.16
    7:00
    1
    18:00
    2
    22.Dec.16
    7:00
    2
    18:00
    3
    23.Dec.16
    7:00
    3
    15:00
    4
    24.Dec.16
    7:00
    4
    18:00
    5
    25.Dec.16
    7:00
    5
    18:00
    6
    26.Dec.16
    7:00
    6
    18:00
    7
    27.Dec.16
    7:00
    7
    17:00
    8
    28.Dec.16
    7:00
    8
    18:00
    9
    29.Dec.16
    10
    30.Dec.16
    11
    31.Dec.16
    12
    1.Jan.17
    7:00
    9
    18:00
    13
    2.Jan.17
    7:00
    10
    18:00
    14
    3.Jan.17
    7:00
    11
    18:00
    15
    4.Jan.17
    7:00
    12
    18:00
    16
    5.Jan.17
    7:00
    13
    18:00
    17
    6.Jan.17
    18
    7.Jan.17
    7:00
    14
    18:00
    19
    8.Jan.17
    7:00
    15
    18:00
    20
    9.Jan.17
    21
    10.Jan.17
    7:00
    16
    18:00
    22
    11.Jan.17
    7:00
    17
    18:00
    23
    12.Jan.17
    7:00
    18
    18:00
    24
    13.Jan.17
    7:00
    19
    18:00
    25
    14.Jan.17
    7:30
    20
    17:30
    26
    15.Jan.17
    7:30
    21
    17:30
    27
    16.Jan.17
    7:30
    22
    17:30
    28
    17.Jan.17
    7:30
    23
    17:30
    29
    18.Jan.17
    7:00
    24
    18:00
    30
    19.Jan.17
    7:00
    25
    18:00
    31
    20.Jan.17
    32
    Worksheet: 121

    Question _1)
    ???? Please explain why you give 26 ??? . I see 25 ????

    _----____________________________________



    Questions 2)
    Quote Originally Posted by nelsondavid View Post
    ......(holiday is deducted if the person does not come the day before and after the holiday).....
    I do not understand
    _2a) Please give example to illustrate this

    _ 2b) (i) What if the above situation arises, and the Holiday is the first or last day of the month ??? - Would you check the month before and after to see if a day was not worked???
    _ 2b) (ii) You will need some external record set at the end of each month which is accessible in the next month to check each sheet for an absence on the last day of all Months.
    _.....



    You must make sure that your test data in Before and After illustrates all possible scenarios( and that it is correct ! )






    Alan
    Last edited by DocAElstein; 02-07-2017 at 10:32 PM.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

  5. #5
    Junior Member
    Join Date
    Jan 2017
    Posts
    9
    Rep Power
    0
    Dear Alan,

    25 days ABSENT ,i.e, Absent 4 days plus one holiday (4 days) -29,31,9,19 and 30 (the employee did not come on 29 and 31 so 30 holiday marked as absent)

    If Question 2 scenario arises holiday is considered present

    Sample attached

    Thanks,

    Nelson
    Attached Files Attached Files

  6. #6
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,316
    Rep Power
    10
    Hi Nelson
    _1)
    Quote Originally Posted by nelsondavid View Post
    .....25 days ABSENT ,i.e, Absent 4 days plus one holiday (4 days) -29,31,9,19 and 30 (the employee did not come on 29 and 31 so 30 holiday marked as absent).......
    This makes no sense ??? I have no idea what you are saying ???


    _2)
    I think you have wrong data again ! ! !

    Your after “File 4 After.xlsx”
    Row\Col
    B
    C
    34
    TOTAL NO. OF DAYS -----> 25
    Worksheet: 121

    Your Before File “File 3 Before.xlsx”
    Using Excel 2007 32 bit
    Row\Col
    E
    F
    G
    1
    21.Dec.16
    7:00
    1
    18:00
    2
    22.Dec.16
    7:00
    2
    18:00
    3
    23.Dec.16
    7:00
    3
    15:00
    4
    24.Dec.16
    7:00
    4
    18:00
    5
    25.Dec.16
    7:00
    5
    18:00
    6
    26.Dec.16
    7:00
    6
    18:00
    7
    27.Dec.16
    7:00
    7
    17:00
    8
    28.Dec.16
    7:00
    8
    18:00
    9
    29.Dec.16
    10
    30.Dec.16
    11
    31.Dec.16
    12
    1.Jan.17
    7:00
    9
    18:00
    13
    2.Jan.17
    7:00
    10
    18:00
    14
    3.Jan.17
    7:00
    11
    18:00
    15
    4.Jan.17
    7:00
    12
    18:00
    16
    5.Jan.17
    7:00
    13
    18:00
    17
    6.Jan.17
    18
    7.Jan.17
    7:00
    14
    18:00
    19
    8.Jan.17
    7:00
    15
    18:00
    20
    9.Jan.17
    21
    10.Jan.17
    7:00
    16
    18:00
    22
    11.Jan.17
    7:00
    17
    18:00
    23
    12.Jan.17
    7:00
    18
    18:00
    24
    13.Jan.17
    7:00
    19
    18:00
    25
    14.Jan.17
    7:30
    20
    17:30
    26
    15.Jan.17
    7:30
    21
    17:30
    27
    16.Jan.17
    7:30
    22
    17:30
    28
    17.Jan.17
    7:30
    23
    17:30
    29
    18.Jan.17
    7:00
    24
    18:00
    30
    19.Jan.17
    31
    20.Jan.17
    Worksheet: 121


    _........................


    _2)
    The test data that you have chosen does not test this scenario “...holiday is deducted if the person does not come the day before and after the holiday...

    Possibly you mean something like this ???
    29.Dec.16
    ABSENT
    30.Dec.16
    7:00
    18:00
    11:00
    9:00
    2:00
    31.Dec.16
    ABSENT
    Worksheet: 121
    ????

    _................................

    Try again !!!

    Quote Originally Posted by DocAElstein View Post
    .....
    You must make sure that your test data in Before and After illustrates all possible scenarios( and that it is correct ! )
    ....
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

  7. #7
    Junior Member
    Join Date
    Jan 2017
    Posts
    9
    Rep Power
    0
    Dear Alan,

    Files attached again and also in column K absent days should be marked as ABSENT

    Rest all seems to be fine

    Thanks,

    Nelson
    Attached Files Attached Files

Similar Threads

  1. Replies: 33
    Last Post: 01-12-2015, 10:08 AM
  2. Replies: 1
    Last Post: 07-23-2013, 10:43 PM
  3. Replies: 0
    Last Post: 09-17-2012, 02:05 PM
  4. The Number of Years, Months and Days Between Two Dates
    By Rick Rothstein in forum Rick Rothstein's Corner
    Replies: 7
    Last Post: 06-08-2012, 10:35 PM
  5. Number of Days In A Month
    By Excel Fox in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 05-14-2011, 08:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •