• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Sumproduct Formula

sachar

Member
Dear All,

With reference to the attached sample file, the SUMPRODUCT formula at [column”4H”] to get the return of value with two conditions Total of BREAKFAST & PERIODICAL (18-Feb-2018 to 21-Feb-2018), but returning value is Zero which is wrong.

May I know what is wrong with SUMPRODUCT formula?

Thanks.
 

Attachments

  • sample file_SUMPRODUCT.xlsx
    10.6 KB · Views: 8
Hi ,

The formula in use in the workbook is :

=SUMPRODUCT((A2:A5=A3)*(B1:F1<=B1)*(B1:F1>=E1)*(B2:F5))

What this does is :

1. It checks for which cell in the range A2:A5 equals the contents of cell A3.

In this case , the only cell which matches is A3 itself.

However , since the SUMPRODUCT function has been used , what is returned is an array {FALSE;TRUE;FALSE;FALSE}.

2. Next , we look at the horizontal array of values in the range B1:F1 , and see which of them is less than or equal to B1. Since the dates in this range are increasing from the start date of 18-Feb-2018 in cell B1 , only that one cell value is less than or equal to the date in B1.

Thus , the return array from this evaluation will be :

{TRUE,FALSE,FALSE,FALSE,FALSE}

3. Next , we look at the horizontal array of values in the range B1:F1 , and see which of them is greater than or equal to E1. Since the dates in this range are increasing from the start date of 18-Feb-2018 in cell B1 , only the two cells E1 and F1 will have values greater than or equal to the date in E1.

Thus , the return array from this evaluation will be :

{FALSE,FALSE,FALSE,TRUE,TRUE}

If we try to understand the logic of these two evaluations 2 and 3 , we are asking Excel to return a set of dates in the range B1:F1 which are less than or equal to the date in B1 , and at the same time , are greater than or equal to the date in E1.

Clearly from the dates in the range , this is impossible.

This is the reason the formula returns 0.

What you want is that Excel returns a set of dates in the range B1:F1 which are greater than or equal to the date in B1 , and at the same time , which are less than or equal to the date in E1. This will then return the dates in B1 , C1 , D1 and E1.

Thus , the revised formula will be :

=SUMPRODUCT((A2:A5=A3)*(B1:F1>=B1)*(B1:F1<=E1)*(B2:F5))

where the changes have been highlighted in red.

Narayan
 
Dear AlanSidman,

Received with thanks for the quick reply, but, sorry to say it is not working. For the right answer, Please go through the following which I received from NARAYANK991.


Dear Narayan,

Thank full to you for elaborate the solution.
 
Back
Top