+ Reply to Thread
Results 1 to 13 of 13

Cumulative sum for weekly average hours over a month

Hybrid View

  1. #1
    Registered User
    Join Date
    08-07-2008
    Location
    London
    Posts
    29

    Cumulative sum for weekly average hours over a month

    I have a column called "Weekly Working Hours" which totals the number of hours worked per week. The cell is filled in every Saturday.

    In the next column I have "Average Weekly Working Hours per Month" which needs to calculate the average number of weekly hours every four weeks, filled in every Saturday.

    Please see attached file. I am referring to columns J and K.

    A simple explanation of the solution would help too.

    Many thanks,

    Alis
    Attached Files Attached Files
    Last edited by alis88; 04-21-2009 at 06:32 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Cumulative sum for weekly average hours over a month

    A few approaches, one would be to use an AVERAGE(IF array:

    K10: =AVERAGE(IF(($B$4:$B10>$B10-28)*(I$4:I10<>""),I$4:I10))
    committed with CTRL + SHIFT + ENTER
    copy to L10

    Be warned however that arrays are expensive performance wise...

    (the above assumes that you're not running XL2007, if you are you can make use of the AVERAGEIF which does not require CTRL + SHIFT + ENTER)
    Last edited by DonkeyOte; 04-21-2009 at 05:36 AM. Reason: operator should be > not >=

  3. #3
    Registered User
    Join Date
    08-07-2008
    Location
    London
    Posts
    29

    Re: Cumulative sum for weekly average hours over a month

    Hey DonkeyOte,

    Thanks for the reply- but I don't think that does what I want, does it?

    I don't think the averaging is working?

    Alis

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Cumulative sum for weekly average hours over a month

    works for me but I did alter the operator from >= to > (@ 10.36am UK time) so if you used the example before then it would have been off slightly ...

    Are you entering as an array as advised (ie with CTRL + SHIFT + ENTER)

    It would be better to post a sample with more complete data such that multiple tests can be conducted.

  5. #5
    Registered User
    Join Date
    08-07-2008
    Location
    London
    Posts
    29

    Re: Cumulative sum for weekly average hours over a month

    I've got it.

    Thank you so much - you're a star!

    Alis xXx

  6. #6
    Registered User
    Join Date
    08-07-2008
    Location
    London
    Posts
    29

    Re: Cumulative sum for weekly average hours over a month

    Quote Originally Posted by DonkeyOte View Post
    A few approaches, one would be to use an AVERAGE(IF array:

    K10: =AVERAGE(IF(($B$4:$B10>$B10-28)*(I$4:I10<>""),I$4:I10))
    committed with CTRL + SHIFT + ENTER
    copy to L10

    Be warned however that arrays are expensive performance wise...

    (the above assumes that you're not running XL2007, if you are you can make use of the AVERAGEIF which does not require CTRL + SHIFT + ENTER)
    Sorry, one more question- how can I add an if="" then "" in that equation? I don't want the numbers to appear if the weekly data isn't there.

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Cumulative sum for weekly average hours over a month

    Not clear I'm afraid - what governs no data - the current week only, ie:

    K10: =IF(AND($I10,$C10="Sat"),AVERAGE(IF(($B$4:$B10>$B10-28)*(I$4:I10<>""),I$4:I10)),"")
    committed with CTRL + SHIFT + ENTER

    The above will for ex. only execute the AVERAGE array if the sum of current weekly hours > 0 (as stipulated by I10 - itself the sum of G range)
    Last edited by DonkeyOte; 04-21-2009 at 06:48 AM. Reason: added SAT clause to reduce implementations of Array calc

  8. #8
    Registered User
    Join Date
    08-07-2008
    Location
    London
    Posts
    29

    Re: Cumulative sum for weekly average hours over a month

    I mean that I don't want the Average Weekly Working Hours per Month cell to be filled unless that week has been worked (see attached).
    Attached Files Attached Files

  9. #9
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Cumulative sum for weekly average hours over a month

    see prior post

+ 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