• 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.

Sum value between two dates with certain criteria.

I need an excel expert
I am attaching a sample file.
Sheet1 contains the data table
In sheet2, you may find some examples I need a formula for
Basically I need a formula that given the value, the start date and end date, it returns me the sum of the cells in sheet1 that match those conditions.

Thanks in advance.
 

Attachments

  • Book3.xlsx
    14.9 KB · Views: 2
I could able to create the formula. But the formula is little large to understand for some.
Can you help with some short formula for required result.
 

Attachments

  • Book4.xlsx
    19.9 KB · Views: 6
In G2 enter
=SUMPRODUCT(--(Sheet1!$A$2:$A$321>=Sheet2!$C2),--(Sheet1!$A$2:$A$321<=Sheet2!$D2)*INDEX(Sheet1!$A$2:$H$321,,MATCH(Sheet2!$B2;Sheet1!$A$1:$H$1,0)))
and pull down
Be aware that the double comma is NOT a typo
 
I forgot to change a semi colon into a comma
=SUMPRODUCT(--(Sheet1!$A$2:$A$321>=Sheet2!$C2),--(Sheet1!$A$2:$A$321<=Sheet2!$D2)*INDEX(Sheet1!$A$2:$H$321,,MATCH(Sheet2!$B2,Sheet1!$A$1:$H$1,0)))
 

Attachments

  • Book4(1).xlsx
    21 KB · Views: 2
Hi @pecoflyer , Can you please help me to understand this formula. How this working. I've tried to understand it by splitting the formula but the expected result not coming. Sorry for bothering you.

Thanks in advance.
 
Congratulations for trying to understand the solution ! Most people just absorb the result and move on :)

The basics of SUMPRODUCT are clearly explained at http://www.xldynamic.com/source/xld.SUMPRODUCT.html
As you can see this function works on ranges
The difficulty here is to define the range with a specific header, and that is the job of the INDEX function which, embedded in another function, returns a range reference for a column or a row when the match value is replaced by a double comma.
There should be better explanations on the Net, but the advanced use of INDEX is not always well documented and I haven't found one yet
If you find a link to a good explanation, please let me know
Cheers
 
Back
Top