+ Reply to Thread
Results 1 to 10 of 10

Trying to create an average calculation of values across sheets, but only from valid cells

  1. #1
    Registered User
    Join Date
    09-23-2017
    Location
    UK
    MS-Off Ver
    2016
    Posts
    5

    Trying to create an average calculation of values across sheets, but only from valid cells

    Hi there,

    Sorry a little complex I know but I'm trying to simplify a spreadsheet so it requires no manual input to automatically update averages.

    Essentially I'm trying to monitor sales across months (each month is in a separate sheet). I want to break down sales into days of the week on average across the months.

    I've worked out how to identify each weekday and then calculate the sum average of each weekday within the month:

    {=AVERAGE(IF(WEEKDAY(C6:C38)=2,U6:U38))} for each weekday
    the calculations for these are in the same cells on each sheet. I've worked out (I think) How to sum up and then average these values across the sheets

    =Average(August:April!X7)
    But what I cannot account for is that the months that have not passed return a "#DIV/0!" result. How do I account for that? I have tried "IF AUGUST:APRIL!X7>0, Average...etc" to no avail, and then I tried the "ISBLANK" statement, but they just return 0. Also, I need the calculation to stop at the current date rather than calculate all of them if the date has not yet elapsed.

    Am I making this too complicated?

    Anyone have any ideas?

  2. #2
    Valued Forum Contributor Root_'s Avatar
    Join Date
    07-29-2017
    Location
    _
    MS-Off Ver
    2010+
    Posts
    484

    Re: Trying to create an average calculation of values across sheets, but only from valid c

    Try using this array formula on your monthly sheets:

    =IFERROR(1/(1/AVERAGE(IF(WEEKDAY(C6:C38)=2,U6:U38))),FALSE)

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,169

    Re: Trying to create an average calculation of values across sheets, but only from valid c

    If months not passed have blank cell, then

    =AVERAGE(August:April!X7)

    should work

  4. #4
    Registered User
    Join Date
    09-23-2017
    Location
    UK
    MS-Off Ver
    2016
    Posts
    5

    Re: Trying to create an average calculation of values across sheets, but only from valid c

    Thanks @John, but won't that add the empty numbers as a divisable number?

    i.e: a series with

    1,2,3,4,5,6,7,0,0,0,0,0

    =(1+2+3+4+5+6+7+0+0+0+0+0)/12 rather than =(1+2+3+4+5+6+7)/7

    ?

  5. #5
    Registered User
    Join Date
    09-23-2017
    Location
    UK
    MS-Off Ver
    2016
    Posts
    5

    Re: Trying to create an average calculation of values across sheets, but only from valid c

    Quote Originally Posted by Root_ View Post
    Try using this array formula on your monthly sheets:

    =IFERROR(1/(1/AVERAGE(IF(WEEKDAY(C6:C38)=2,U6:U38))),FALSE)
    Thanks @root I'm gonna give this a go later on, I solved this temporarily by fully populating all cells with '0' and putting all dates in, this then delivered a '0' instead of a "#Div/0" result and made the rest work.

  6. #6
    Registered User
    Join Date
    09-23-2017
    Location
    UK
    MS-Off Ver
    2016
    Posts
    5

    Re: Trying to create an average calculation of values across sheets, but only from valid c

    Quote Originally Posted by JohnTopley View Post
    If months not passed have blank cell, then

    =AVERAGE(August:April!X7)

    should work
    Thanks @John, but won't that add the empty numbers as a divisable number?

    i.e: a series with

    1,2,3,4,5,6,7,0,0,0,0,0

    =(1+2+3+4+5+6+7+0+0+0+0+0)/12 rather than =(1+2+3+4+5+6+7)/7

    ?

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,169

    Re: Trying to create an average calculation of values across sheets, but only from valid c

    Change the zero values to blank and they will not be counted.

  8. #8
    Registered User
    Join Date
    09-23-2017
    Location
    UK
    MS-Off Ver
    2016
    Posts
    5

    Re: Trying to create an average calculation of values across sheets, but only from valid c

    Sadly that would break the solution to get the weekly totals formula! I will try @roots solution with the blanks and see if I can get it to work with the Average.

    I even tried 'averageif<a1:a5, "<>0") but that didn't seem to work (plus wouldnt be right if no sales were made on a day that has elapsed).

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,169

    Re: Trying to create an average calculation of values across sheets, but only from valid c

    break the solution to get the weekly totals formula!
    Why?

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,000

    Re: Trying to create an average calculation of values across sheets, but only from valid c

    These 3D formulae aere NOT simple.... I can get this to work easily enough with a helper column in each month. I haven't been able to coerce WEEKDAY into working in the "standard" SUMPRODUCT 3D array structure...

    If you want the ability to change the dates around, use the formula in B3.

    If you want all the days at the same time, use the formulae from B8:B14, eg:

    =SUMPRODUCT(SUMIFS(INDIRECT("'"&List&"'!U6:U36"),INDIRECT("'"&List&"'!B6:B36"),ROWS(B$8:B8),INDIRECT("'"&List&"'!U6:U36"),"<>"&""))/SUMPRODUCT(COUNTIFS(INDIRECT("'"&List&"'!B6:B36"),ROWS(B$8:B8),INDIRECT("'"&List&"'!U6:U36"),"<>"&""))

    for Sunday..

    List is a Named Range, containing all of the monthly sheets. In the attachment, there are just 3. CTRL-F3 to adjust...
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

+ 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. How to create a dynamic sum calculation over multiple sheets using INDIRECT?
    By The_Snook in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-04-2015, 11:06 AM
  2. [SOLVED] Create sheets according to unique values in cells
    By G.Bregvadze in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-20-2014, 10:28 AM
  3. Replies: 0
    Last Post: 11-04-2013, 01:48 PM
  4. Removing non existant values from an 'average calculation
    By alocke in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-08-2012, 04:48 PM
  5. AVERAGE calculation to exclude blank cells
    By andrewc in forum Excel General
    Replies: 8
    Last Post: 09-04-2009, 03:30 AM
  6. Macro to change the number cells in a average calculation.
    By Robin Quinnell in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2007, 11:01 AM
  7. [SOLVED] calculation a average dependated of values in seperate column
    By vinnie123 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-15-2006, 10:00 PM

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