+ Reply to Thread
Results 1 to 4 of 4

Sum time value within a certain time range

  1. #1
    Registered User
    Join Date
    02-16-2014
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    2

    Sum time value within a certain time range

    Hello,


    I am trying to get my excel sheet to automatically count the "normal" day hours and the "evening" hours, as they have different pay values.
    My question is, if there a way to get excel to calculate the two separate times, within that one shift, which crosses over from the day to evening shift.
    the evening hours are from 1900 to 0700.

    For example:

    a shift starts at 06:00 and ends at 12:30
    This shift counts 1 hour of "evening" pay and 5,5 hours of "day" pay.


    shift starts at 12:00 and ends at 21:00
    This shift then counts 7 hours of "day" pay and 2 hours of "evening" pay...

    is there any way of doing it automatically?
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Sum time value within a certain time range

    Hi and welcome to the forum

    for "normal" time, try this...
    =IF(AND(OR(B3<7/24,B3>19/24),OR(B3>19/24,C3>19/24)),0,IF(B3<=7/24,IF(C3>19/24,19/24,C3)-7/24,IF(C3>19/24,19/24,C3)-B3))
    For OT, try this...
    =IF(B3<7/24,B3,0)+IF(C3>19/24,C3-19/24,0)

    Test with a range of times and let me know how you make out?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    02-16-2014
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Sum time value within a certain time range

    Hi FDibbins! thank you for your quick response!

    I entered the formulas into my spreadsheet, it works, but, once the times 06:00 to 12:00 are added in, then the normal time shows 5 and the OT shows 6. However, the OT should only show 1 and the rest should be under the normal time..

    Same goes for 06:00 to 20:00, the "OT" time should only be 2, yet it shows 7, and the normal time is reduced to zero..


    hope you can fix it! :D

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Sum time value within a certain time range

    Thats for the update, I had a feeling I had missed some stuff out.

    For regular time...
    =IF(OR(AND(B3<7/24,B3>19/24),AND(B3>19/24,C3>19/24)),0,IF(C3>19/24,19/24,C3)-IF(B3<7/24,7/24,B3))
    For the OT...
    =IF(B3<7/24,7/24-B3,0)+IF(C3>19/24,C3-19/24,0)

    Test and let ne know?

    B
    C
    D
    E
    2
    from
    to
    normal
    rate
    evening
    rate
    3
    6:00
    12:00
    5:00:00
    1:00:00
    4
    6:00
    20:00
    12:00:00
    2:00:00
    5
    20:00
    21:00
    0:00:00
    2:00:00
    6
    9:00
    17:00
    8:00:00
    0:00:00

+ 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. [SOLVED] Counting values in a time range - when the time range crosses midnight
    By dlocos in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-24-2014, 04:27 AM
  2. How can I fill a combobox from a range of data which is changing time to time?
    By greenluck57 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-25-2013, 06:15 AM
  3. compare time values - current time with time in cell range?
    By wyattea in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-13-2013, 11:28 PM
  4. [SOLVED] average time based on clock time range
    By xrayexceller in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 07-23-2013, 06:40 PM
  5. Display the date and time each time the data in a cell range is changed
    By BVZM in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-24-2012, 01:23 PM

Tags for this Thread

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