View Poll Results: Was this Query useful?

Voters
1. You may not vote on this poll
  • Very Useful

    1 100.00%
  • Common

    0 0%
Multiple Choice Poll.
+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 23

Thread: How to get the Sum in a Single SUMPRODUCT maintaining the Different Criterions?

  1. #1
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    1,697

    How to get the Sum in a Single SUMPRODUCT maintaining the Different Criterions?

    How to get the Sum in a Single SUMPRODUCT maintaining the Different Criterions?

    Dear Forum,

    I came across a situation while using Sumproduct which gives me an answer however there are certain criterions which need to influence the Column to be Summed..

    I was wondering that can be achieved in a single formula or not?

    Please find the attachement where the SUMMING has to be done for a specific date and then the Columns to be SUmmed would be based on the selection in the column C Fruits..

    FOr Ex:- Date 4-May-11 There are 4 instances where this date appears in the Data and there are 4 different fruits selected which I need to add if possible using a single formula, it can be any formula preferably SUMPRODUCT.


    the four fruits selected are Oranges,APples, Bananas and Mango...

    So I need the sum of the Fruits on this date and for all the above fruits..


    Warm Regards
    e4excel
    Attached Files Attached Files
    Last edited by NBVC; 01-16-2012 at 03:38 PM.

  2. #2
    Registered User
    Join Date
    09-26-2010
    Location
    A, A
    MS-Off Ver
    Excel 2003
    Posts
    59

    Re: How to get the Sum in a Single SUMPRODUCT maintaining the Different Criterions?

    Where are the fruits selected in your sheet, i see only one Apple selected under the date, could you be more clear with your requirement for Eg: where exactly are u selecting the 4 fruits?

  3. #3
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    1,697

    Re: How to get the Sum in a Single SUMPRODUCT maintaining the Different Criterions?

    No There is no selection required as the requirement is to be able to use the Single Column Range from the Defined Name FruitData as I require the Sum of all the Fruits falling on the selected date but the selection is done for the Fruits in the Column C so actually when the selected Fruit is Apple then for the selected date i.e. 4 May 11 I need to get the count of only the Apples in that ROw even though there are other numbers mentioned in the different Columns but they shoukd be ignored and only the respective column of selction to be considered in the final summation..

    Now, since there are 4 instances of 4 May 2011 we need to actually sum 4 different columns for each row of the date 4 May 2011 and The expected answer should be 35+42+42+39 = 158

    I ---- 4-May-11----Oranges -35
    II ---- 4-May-11---Apples ---42
    III ---- 4-May-11--Bananas--42
    IV ---- 4-May-11--Mango----39

    Warm Regards
    e4excel
    Last edited by e4excel; 01-16-2012 at 02:46 PM.

  4. #4
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,637

    Re: How to get the Sum in a Single SUMPRODUCT maintaining the Different Criterions?

    Try:

    =SUMPRODUCT((SUBSTITUTE(Fruit,"Fruit","")=FData)*(Date=E17),FruitData)
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  5. #5
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    1,697

    Re: How to get the Sum in a Single SUMPRODUCT maintaining the Different Criterions?

    Wow,

    NBVC that's exactly what I needed a short crips formula in one line..Honestly this wasa dummy example as I have my actual file is with more columns and would have been complicated to get a notice so kept a easier to explain example..

    So intentionally has the Blank Columns as the main purpose was to only focus on the Fruit specific columns ...

    Wow thats really great and thanks a lot once again...

    Good to see you back..@

    Warm Regards
    e4excel

  6. #6
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    1,697

    Re: How to get the Sum in a Single SUMPRODUCT maintaining the Different Criterions?

    Dear NBVC,

    I tried it in the actual file and it woeks fantastically however there are certain criterions only specific to a certain condition then I was just thinking how would I make it work for only that...

    Actual Example :

    I have 4 Modes of Payment in which there are 4 different columns and for specifically cheque payment I need to also have it as cleared to conisder it in the Final Summation...

    =SUMPRODUCT(--(SubSrNoRng=$B2)*(PymtForRng="Regular Payments")*(ChqStatusRng="Cleared")*(SUBSTITUTE(CashToCrdt,"Amount","")=ModesRng),AmtRng)
    Basic Formula :
    =SUMPRODUCT(--(SubSrNoRng=$B2)*(PymtForRng="Regular Payments")*(SUBSTITUTE(CashToCrdt,"Amount","")=ModesRng),AmtRng
    THis is the condition which is only for the Cheque Payment
    [ (ChqStatusRng="Cleared") ]
    so how do I make it common as well as exclusive in the same approach as with your help the basic formula works brilliantly..

    So, I need to know when the payment mode is Cheque in the ModesRng then how do I check if the ChqStatusRng is cleared or not if its cleared then only i need to add the amount to the final summation and this should not influence any other type of payment..

    Actually the query is solved but this little bit just remained..

    Warm Regards
    e4excel

  7. #7
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,637

    Re: How to get the Sum in a Single SUMPRODUCT maintaining the Different Criterions?

    I am not understanding fully.

    Can you post a better sample workbook with the request outlined.. and expected results shown.
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  8. #8
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    1,697

    Re: How to get the Sum in a Single SUMPRODUCT maintaining the Different Criterions?

    The only remaining thing is the Cleared Status is only applicable for the Cheque Mode so how would I make this Influence the result which is a combination of different Modes and there are remaining 3 Modes which do not need to have it as "Cleared".

    Intentionally for readablity purposes put the formula in Quotes

    SUM(SUMPRODUCT(--(SubSrNoRng=$B2)*(ModesRng="Cash")*(PymtForRng="Regular Payments")*(CashAmtRng>2),(CashAmtRng)),SUMPRODUCT(--(SubSrNoRng=$B2)*(ModesRng="Cheque")*(ChqStatusRng="Cleared")*(PymtForRng="Regular Payments"),(ChqAmtRng)),SUMPRODUCT(--(SubSrNoRng=$B2)*(ModesRng="RTGS/NEFT")*(PymtForRng="Regular Payments"),(RTGS_NEFTAmtRng)),SUMPRODUCT(--(SubSrNoRng=$B2)*(ModesRng="Credit Card")*(PymtForRng="Regular Payments"),(CrdtCardAmtRng))))
    I was using such a big formula to get the answer but thanks to you that I can have it much shortened however with this remaining bit...

    In the Picture there are several columns Hidden to accomodate the Columns and only the important and relevant ones are kept.
    Please find this Picture as a reference

    Warm Regards
    e4excel
    Attached Files Attached Files
    Last edited by e4excel; 01-16-2012 at 04:20 PM.

  9. #9
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,637

    Re: How to get the Sum in a Single SUMPRODUCT maintaining the Different Criterions?

    Where's the attachment?
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  10. #10
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    1,697

    Re: How to get the Sum in a Single SUMPRODUCT maintaining the Different Criterions?

    Sorry the net speeds pathetic ..its attached now..

  11. #11
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    1,697

    Re: How to get the Sum in a Single SUMPRODUCT maintaining the Different Criterions?

    I had a similar query earlier..

    The link ias mentioned below and the attachment is the same as in the post # 6 of this query..

    http://www.excelforum.com/excel-work...terions-2.html

    Unfortunately I have some confidential data and therefore would require more time to strip the data and to create a sample workbook..

    Warm Regards
    e4excel

  12. #12
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,637

    Re: How to get the Sum in a Single SUMPRODUCT maintaining the Different Criterions?

    I prefer spreadsheet sample for testing... and also what would be the expected result and why?

    This is just a guess to try:

    =SUMPRODUCT(((ChqStatusRng="Cleared")+(SubSrNoRng=$B2)*(PymtForRng="Regular Payments")*(SUBSTITUTE(CashToCrdt,"Amount","")=ModesRng)),AmtRng)
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  13. #13
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    1,697

    Re: How to get the Sum in a Single SUMPRODUCT maintaining the Different Criterions?

    I am afraid that does not work...>

    WOuld request you to Please check the Post #6 in the Links QUery as my net speed is not good to save and upload the same file...

    Example for any client if we just have Four Examples
    Cash
    Credit
    RTGS/NEFT
    Credit Card

    Then all payments are for Rs 500 then I need that the payment for the Cheque Status should also be mentioned as "Cleared" for it to be added in the final COlumn...

    SO the answer would be Rs 2000/- as the other three modes just require the "Regular Payments" and not "Cleared" which is only for the Cheque Category..

    The cheque Mode also requires the "Regular Payments"..

    Warm Regards
    e4excel

  14. #14
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,637

    Re: How to get the Sum in a Single SUMPRODUCT maintaining the Different Criterions?

    Just like DO in that thread, I am afraid I am lost as to your request at the moment.. I am finished anyway for the day... If you could come up with a good example showing the possibilities you would like addressed and the expected various outcomes, then I could try looking at it again tomorrow....
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  15. #15
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    1,697

    Re: How to get the Sum in a Single SUMPRODUCT maintaining the Different Criterions?

    No issues NBVC, I will make a sample workbook tommorow...you can have your sleep...
    Good Night for mow..

    But I must say that I really am impressed with that solution and good that i had that example or else would not have even reached where you took off..
    Actually there a lot of other requirements too in that same file which I am trying to manage but wil upload it at the earliest but please do help meand let me know even if you would want me to start a new thread though its the same requirement with an additional criterion which is not common for all..

    Warm Regards
    e4excel

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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