+ Reply to Thread
Results 1 to 7 of 7

Y-T-D averages

Hybrid View

  1. #1
    Registered User
    Join Date
    09-22-2007
    Posts
    4

    Y-T-D averages

    Here's what I'm struggling with. See the attached test sheet. I need
    formulas for lines 34, 50, and 66. Line 34, for example, should average
    D6 thru D17 and D20 thru D32. The formula also has to ignore zero values or empty cells in case there is no value for a week and because future weeks will be blank. The y-t-d average has to keep adding the latest week of data. This is beyond me at this point. Any help would be really appreciated.
    TEST sheet.txt

  2. #2
    Forum Contributor
    Join Date
    07-05-2007
    Location
    Lexington, MA
    Posts
    302
    Maybe this idea will help. Say your values are in B4:B9, then the following will average only the non-zero values.
    =SUM(B4:B9)/COUNTIF(B4:B9,"<>0")
    FrankBoston is the pen name for Andrew Garland, Lexington MA

  3. #3
    Registered User
    Join Date
    09-22-2007
    Posts
    4
    How would the formula look if I want to average different groups of cells like B4:B9 and B14:B19 and B23:B28 for example? To get my y-t-d averages I'll be pulling numbers from 1Q, then 1Q & 2Q, then 1Q, 2Q, 3Q, etc.

  4. #4
    Forum Contributor
    Join Date
    07-05-2007
    Location
    Lexington, MA
    Posts
    302
    Uploading your workbook would make things understandable. Place the XLS into a zipped folder and upload the folder.

  5. #5
    Registered User
    Join Date
    09-22-2007
    Posts
    4
    Here's the zip file.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    07-05-2007
    Location
    Lexington, MA
    Posts
    302

    SumProduct used and explained

    See the attached workbook for the implementation.

    These formulas use the presence of a Week Number in Col A only for rows
    holding data, not subtotals.

    Average for the prior 13 rows
    
    =SUMPRODUCT(--(A20:A32<>0), D20:D32) / SUMPRODUCT(--(A20:A32<>0), --(D20:D32<>0))
                      A            B                      A1              B1
    Term A : 1 if there is a Week number in Col A, 0 otherwise
             Keeps other subtotals out of the sum
    Term B : All of the amounts for the 13 weeks, including 0's
    Term A1: Same form and purpose as A
    Term B1: 1 if the amount is <> 0,  0 otherwise. This counts only the non-zero
             quantities for making the average
    
    The '--' in front of the terms converts the logical value into 0 for False, 1 for 
    
    True
    
    ---
    Average for all of the rows
    
    =SUMPRODUCT(--(A$6:A32<>0), D$6:D32) / SUMPRODUCT(--(A$6:A32<>0),--(D$6:D32<>0))
    
    This is the same as the first formula, except that the start row is fixed at
    row 6 by using A$6 instead of say A6.
    Attached Files Attached Files

+ 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