+ Reply to Thread
Results 1 to 5 of 5

Calculate number of sessions based on time

  1. #1
    Registered User
    Join Date
    08-13-2022
    Location
    UK
    MS-Off Ver
    Professional plus 2016
    Posts
    8

    Calculate number of sessions based on time

    I was wondering if there was a way of calculating sessions based on two times.
    Between 07:01 and 19:00 -4 hours is 1 PA
    Between 19:01 and 07:00 - 3 hours is 1 PA

    So if I have a table that has

    Shift Start Finish PAs
    Day 09:00 17:00 2
    Late 17:00 22:00 1.5

    Is there a way of using a formula to calculate the value?

    Thanks in advance

    Tudor

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,720

    Re: Calculate number of sessions based on time

    I get this, see formulas in column H:

    Values as displayed
    A
    B
    C
    D
    E
    F
    G
    H
    1
    After
    Up to
    Hours per PA
    Shift
    Start
    Finish
    PAs
    2
    7:00
    19:00
    4
    Day
    9:00
    17:00
    2
    3
    19:00
    7:00
    3
    Late
    17:00
    22:00
    1.5

    Underlying formulas
    A
    B
    C
    D
    E
    F
    G
    H
    1
    After
    Up to
    Hours per PA
    Shift
    Start
    Finish
    PAs
    2
    0.291666666666667
    0.791666666666667
    4
    Day
    0.375
    0.708333333333333
    =(1/4)*24*(MIN($B$2,G2)-MAX(F2,$A$2))+(1/3)*24*MAX(0,(MIN($B$3+1,G2+IF(G2<F2,1,0))-(MAX(F2,$A$3))))
    3
    0.791666666666667
    0.291666666666667
    3
    Late
    0.708333333333333
    0.916666666666667
    =(1/4)*24*(MIN($B$2,G3)-MAX(F3,$A$2))+(1/3)*24*MAX(0,(MIN($B$3+1,G3+IF(G3<F3,1,0))-(MAX(F3,$A$3))))
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    08-13-2022
    Location
    UK
    MS-Off Ver
    Professional plus 2016
    Posts
    8

    Re: Calculate number of sessions based on time

    Thank you that works great.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,720

    Re: Calculate number of sessions based on time

    I didn't do much testing, just the two samples you gave. If you hit a snag, post back to this thread.

    If a member helped you solve your problem, consider adding to their reputation by clicking addreputationiconsmall.jpg below their name.

  5. #5
    Registered User
    Join Date
    08-13-2022
    Location
    UK
    MS-Off Ver
    Professional plus 2016
    Posts
    8

    Re: Calculate number of sessions based on time

    Thanks - it works well - had to figure out to get the time beyond midnight I had to add it to 24 - so for 3am I would put the time in as 27:00 and it would correct to 03:00 and the calculation would work.
    Thank you

+ 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] Descending ranking based on two scoring sessions
    By herukuncahyono in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-24-2022, 06:48 AM
  2. Replies: 1
    Last Post: 07-13-2019, 01:12 PM
  3. Counting simulataneus user sessions in time period
    By macjola in forum Excel General
    Replies: 4
    Last Post: 07-24-2017, 04:44 AM
  4. [SOLVED] Calculate the portion of a planned number during a period, based on another time period
    By BryGuy81 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-19-2017, 01:29 PM
  5. Number of sessions
    By learning_2_excel in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-12-2015, 08:38 AM
  6. Replies: 1
    Last Post: 08-21-2013, 09:26 AM
  7. Replies: 2
    Last Post: 03-26-2010, 09:16 AM

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