+ Reply to Thread
Results 1 to 5 of 5

averageif spill error

  1. #1
    Registered User
    Join Date
    09-10-2015
    Location
    London
    MS-Off Ver
    365 at work, 2016 at home
    Posts
    79

    averageif spill error

    Hi all,
    I need an averageif with another function nested on the criteria, #=SUMIF(B5:B35,WEEKDAY(B5:B35,1)=1,C26:C33)# b5:35 are dates that automatically update each month. (when you open the book, you'll see they're set to display only DDD mon, tue etc, but that doesn't really matter).
    I just want an average of the values from all the Mondays in the month, all the Tuesdays etc.

    My current attempt is spilling to the same length as the range, and all values are erroring.

    EDIT Hoorah I can attach again. don't know who fixed it, but thank you.
    Attached Files Attached Files

  2. #2
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: averageif spill error

    Please try at

    F40
    =SUMPRODUCT(--(TEXT($B$5:$B$35,"dddd")=A40),$C$5:$C$35)/SUMPRODUCT((TEXT($B$5:$B$35,"dddd")=A40)*($C$5:$C$35<>""))

    or with a helper column
    D4
    =TEXT(B5,"dddd")

    G40
    =AVERAGEIFS($C$5:$C$35,$D$5:$D$35,A40)
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    09-10-2015
    Location
    London
    MS-Off Ver
    365 at work, 2016 at home
    Posts
    79

    Re: averageif spill error

    Quote Originally Posted by Bo_Ry View Post
    Please try at

    F40
    =SUMPRODUCT(--(TEXT($B$5:$B$35,"dddd")=A40),$C$5:$C$35)/SUMPRODUCT((TEXT($B$5:$B$35,"dddd")=A40)*($C$5:$C$35<>""))

    or with a helper column
    D4
    =TEXT(B5,"dddd")

    G40
    =AVERAGEIFS($C$5:$C$35,$D$5:$D$35,A40)
    It certainly works, and it's genius! had a go through it with formula evaluate, didn't know you could do that with text. are there any other text values you can convert to numbers or is it just true/false=binary? sidebar.

    Secondly, Sorry! seems I oversimplified the example. was expecting an averageif, or maybe sumif/(sumif or countif) so I could just add the extra column of criteria and turn them into ...ifS
    So, on the D col I have a drop down select with four options. if a specific one of them is selected, I DON'T want to include that day's values in the calculation. For ease, let's put the options on d:1-4 and the one to exclude on d1.
    Last edited by cheesemeister; 01-22-2021 at 05:45 AM.

  4. #4
    Registered User
    Join Date
    09-10-2015
    Location
    London
    MS-Off Ver
    365 at work, 2016 at home
    Posts
    79

    Re: averageif spill error

    Think I've got it, it seems to work anyway.
    Not sure I understand why the sumprod under the / is separated by * and not , but seems I can apply it. I figure it has to do with the term after that being logical. would be useful to know for sure to make it easier to spot in future, particularly if it applies to other formula.
    Anyway, this is what seems to be working.
    #=SUMPRODUCT(--(TEXT($B$5:$B$35,"dddd")=A40)*--($D$5:$D$35<>$D$1),$C$5:$C$35)/SUMPRODUCT((TEXT($B$5:$B$35,"dddd")=A40)*--($C$5:$C$35<>$C$40)*($C$5:$C$35<>""))#
    Thanks muchly.

  5. #5
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: averageif spill error

    -- ,*1 is for change boolean true, false to 1,0 for sumproduct to calculate
    I would use -- for single-column boolean as this perform faster
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    But for multiply-columns boolean, even though -- is faster but * is a bit shorter

    Formula: copy to clipboard
    Please Login or Register  to view this content.



    ,$C$5:$C$35) column with number should be separated with, comma. this help for Sumproduct to ignore text.

    Key "a" in C5 , the formula above still show number but

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    *$C$5:$C$35) this will cause error

+ 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. Replies: 5
    Last Post: 01-27-2021, 12:07 PM
  2. Using UNIQUE function with table ranges, cant avoid #SPILL! error
    By Lacaycer in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-22-2020, 09:38 AM
  3. #spill! error
    By julee.stein in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-17-2020, 10:18 PM
  4. [SOLVED] Spill Error...
    By Tamarissa in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-14-2020, 11:31 PM
  5. Replies: 3
    Last Post: 08-09-2020, 10:57 AM
  6. Spill Error with index match formula
    By Daniel_ISS in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-10-2020, 09:36 AM
  7. [SOLVED] sumif producing SPILL error
    By jrtaylor in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-14-2019, 10:44 AM

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