+ Reply to Thread
Results 1 to 14 of 14

sumproduct with date criteria and blanks in array

  1. #1
    Forum Contributor
    Join Date
    11-18-2014
    Location
    England
    MS-Off Ver
    365
    Posts
    132

    sumproduct with date criteria and blanks in array

    this is a bit of an odd one. in the attached sheet I have a formula in column D which is working out the following

    Count how many dates in column A on sheet 2 match the month and year in the row on sheet 1 - There are 88 matches - However there are only 86 that have a corresponding number in column B
    For those that match add up the numbers in column B on sheet 2 - this equals 1272
    Divide this total by the number that meet the specified month and year criteria to give an average - this should equal 14.8 but the formula is counting blank cells in column B and including them and giving the answer 14.5 -

    How do I amend the formula in column D on sheet 1 to ignore these blank cells and only work out the average for cells that have matching date criteria AND a corresponding number in column B? I have tried adding the <>"" at the end of the array in question but it gives value of 0 - see column E on sheet 1

    Any help appreciated!
    Thanks
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: sumproduct with date criteria and blanks in array

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

  3. #3
    Forum Contributor
    Join Date
    11-18-2014
    Location
    England
    MS-Off Ver
    365
    Posts
    132

    Re: sumproduct with date criteria and blanks in array

    Hi Fluff13 - this works perfectly thank you, however I have a related question as just come across this in the same sheet - if I wanted to add in another criteria in column C on sheet 2 for example - where everything matches date criteria and has matching number in column B and a specified criteria in column C say A how would I do this?

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: sumproduct with date criteria and blanks in array

    Just add the new criteria in the same way as the two that are already there.

  5. #5
    Forum Contributor
    Join Date
    11-18-2014
    Location
    England
    MS-Off Ver
    365
    Posts
    132

    Re: sumproduct with date criteria and blanks in array

    I am trying this but getting #VALUE? I have added letters in column C on sheet 2

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

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: sumproduct with date criteria and blanks in array

    The range is not correct, it should be Sheet2!$C$3:$C$763

  7. #7
    Forum Contributor
    Join Date
    11-18-2014
    Location
    England
    MS-Off Ver
    365
    Posts
    132

    Re: sumproduct with date criteria and blanks in array

    Ahh yes typo! apologies corrcted but now I get #DIV

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

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: sumproduct with date criteria and blanks in array

    In that case can you upload a workbook that shows the problem.

  9. #9
    Forum Contributor
    Join Date
    11-18-2014
    Location
    England
    MS-Off Ver
    365
    Posts
    132

    Re: sumproduct with date criteria and blanks in array

    Please see example sheet 2 uploaded
    Attached Files Attached Files

  10. #10
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: sumproduct with date criteria and blanks in array

    You are getting the div/0 error because there is only one row for Jul 2022 that has an A in col C & that row is blank in col B

  11. #11
    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,053

    Re: sumproduct with date criteria and blanks in array

    The blank cells aren't blank. They contain a space. Either:

    =LET(A,Sheet2!$B$3:$B$763,IFERROR(AVERAGE(FILTER(A,(A<>" ")*(TEXT(Sheet2!$A$3:$A$763,"myyyy")=A2&C2))),""))

    copied down... or (delete expected results first):

    =LET(A,Sheet2!$B$3:$B$763,IFERROR(BYROW(A2:A8&C2:C8,LAMBDA(x,AVERAGE(FILTER(A,(A<>" ")*(TEXT(Sheet2!$A$3:$A$763,"myyyy")=x))))),""))
    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

  12. #12
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: sumproduct with date criteria and blanks in array

    The blank cells aren't blank.
    Good spot, but average ignores text, so it's not a problem.

  13. #13
    Forum Contributor
    Join Date
    11-18-2014
    Location
    England
    MS-Off Ver
    365
    Posts
    132

    Re: sumproduct with date criteria and blanks in array

    ok. thanks Fluff13 that makes sense! I hadn't realised the letters had not copied all the way down - this is working now and I can wrap in an IFERROR to remove the CALC errors where there are blanks in column B

    Thanks for your input too Glenn Kennedy, I'll save this formula as well.

  14. #14
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: sumproduct with date criteria and blanks in array

    Rather than using IfError, you can use
    Formula: copy to clipboard
    Please Login or Register  to view this content.

+ 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. List Array Formula with Criteria skip blanks
    By hjforever83 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-24-2020, 01:05 PM
  2. [SOLVED] Sumproduct when 1 array has multiple criteria
    By mark.c in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-14-2019, 01:24 PM
  3. [SOLVED] SUMPRODUCT(SUMIF(....)) where criteria is range of cells with blanks in between
    By dluhut in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-23-2018, 04:55 PM
  4. SUMPRODUCT or SUMIF using an array for criteria
    By rarascon in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-24-2013, 03:14 PM
  5. [SOLVED] Sumproduct - 2 criteria with different array sizes
    By Lacaycer in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-03-2012, 02:24 PM
  6. Replies: 3
    Last Post: 01-07-2012, 02:51 AM
  7. Replies: 5
    Last Post: 06-14-2006, 07:10 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