+ Reply to Thread
Results 1 to 16 of 16

=SUMPRODUCT help with 3 criteria's

  1. #1
    Registered User
    Join Date
    11-07-2012
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    58

    =SUMPRODUCT help with 3 criteria's

    I currently use this formula for 2 variables

    =SUMPRODUCT((Database!$D$2:$D$200=$B6)*(Database!$E$2:$E$200=C$4))

    Basically looks like this, (sorry I don't know how to format)

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    As you can see, sheet 2 adds up the number by matching the correct text, Building A and Red and so on.

    I want to add another criteria by adding a month of when the door was painted if possible? so

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Right now, mine only checks by matching the building name and door colour, I was wondering how do I add a month criteria into the equation? is the best way by adding the month name to match or simply by date?

    I hope this makes sense. I simply just want to use another criteria to check month aswell.

    could anyone enlighten me too please,

    regards

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,725

    Re: =SUMPRODUCT help with 3 criteria's

    In Sheet2 you can put dates in the cells E4, F4 etc. which are the first of the month, e.g. 1/01/2017, 1/02/2017, and apply a custom format to those cells of "mmmm" to display "January", "February" and so on, OR you could just enter the month name as text, whichever you find most convenient. However, the formula would have to be different in the two cases. First case (with dates):

    =SUMPRODUCT((Database!$D$2:$D$200=$B6)*(Database!$E$2:$E$200=C$4)*(MONTH(Database!$F$2:$F$200)=MONTH(E$4)))

    Second case (text months):

    =SUMPRODUCT((Database!$D$2:$D$200=$B6)*(Database!$E$2:$E$200=C$4)*(TEXT(Database!$F$2:$F$200,"mmmm")=E$4))

    If you have blank dates in the range F2:F200 it would be better to use the second approach, to avoid errors.

    Hope this helps.

    Pete.

    P.S. In future it would be better to attach a sample Excel workbook, so we don't have to guess what ranges you are using.

    To do this, click on Go Advanced (below the Edit Window) while you are composing a reply, then scroll down to and click on Manage Attachments and the Upload window will open. Click on Browse and navigate to (and double-click) the file icon that you want to attach, then click on Upload and then on Close this Window to return to the Edit window. When you have finished composing your post, click on Submit Post.

    Note that the Paperclip icon does not work.

    Pete

  3. #3
    Registered User
    Join Date
    11-07-2012
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    58

    Re: =SUMPRODUCT help with 3 criteria's

    Quote Originally Posted by Pete_UK View Post
    In Sheet2 you can put dates in the cells E4, F4 etc. which are the first of the month, e.g. 1/01/2017, 1/02/2017, and apply a custom format to those cells of "mmmm" to display "January", "February" and so on, OR you could just enter the month name as text, whichever you find most convenient. However, the formula would have to be different in the two cases. First case (with dates):

    =SUMPRODUCT((Database!$D$2:$D$200=$B6)*(Database!$E$2:$E$200=C$4)*(MONTH(Database!$F$2:$F$200)=MONTH(E$4)))

    Second case (text months):

    =SUMPRODUCT((Database!$D$2:$D$200=$B6)*(Database!$E$2:$E$200=C$4)*(TEXT(Database!$F$2:$F$200,"mmmm")=E$4))
    If you have blank dates in the range F2:F200 it would be better to use the second approach, to avoid errors.
    E$4 = the name of the month?

    (TEXT(Database!$F$2:$F$200,"mmmm")= do I need to change the TEXT to the name of the month too? or the on in the "mmmm"? to change.

    Sorry I'm abit confused.

    I put
    =SUMPRODUCT((Database!$D$2:$D$200=$B6)*(Database!$E$2:$E$200=C$4)*(TEXT(Database!$C$2:$C$200,"January")=D$3))

    is this correct? this D$3)) referring to the word on the 2nd sheet which is January, correct?
    Last edited by liqt; 01-30-2017 at 07:16 AM.

  4. #4
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: =SUMPRODUCT help with 3 criteria's

    =SUMPRODUCT((Database!$D$2:$D$200=$B6)*(Database!$E$2:$E$200=C$4)*(TEXT(Database!$c$2:$c$200,"mmmm")=d$3))

    is what I think you need if your dates are in column C

  5. #5
    Registered User
    Join Date
    11-07-2012
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    58

    Re: =SUMPRODUCT help with 3 criteria's

    Quote Originally Posted by davsth View Post
    =SUMPRODUCT((Database!$D$2:$D$200=$B6)*(Database!$E$2:$E$200=C$4)*(TEXT(Database!$c$2:$c$200,"mmmm")=d$3))

    is what I think you need if your dates are in column C
    I'm still getting the same number as without by adding the new criteria.

    if I understand, to break down the formula

    *(TEXT(Database!$F$2:$F$200,"mmmm")=d$3))

    TEXT = do I leave this as just TEXT?

    Database!$F$2:$F$200 = the month displayed on that sheet

    mmmm = formatted cell by month name only

    d$3 = name of the month of the 2nd sheet

    is that correct?

    in the end result, I'm simply just trying to add up if A + B + C = 1

    if A + B only, that is not 1. hence why C is the 3rd factor to include, which is the date/month

  6. #6
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: =SUMPRODUCT help with 3 criteria's

    Why not attach a spreadsheet as Pete suggests above, following his instructions. Your dates could be text and visa versa. It makes an answer much easier to give.

  7. #7
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,725

    Re: =SUMPRODUCT help with 3 criteria's

    Why can't you just attach a sample Excel workbook, as I described in Post #2, and then we can see what cells and ranges you are using.

    Pete

  8. #8
    Registered User
    Join Date
    11-07-2012
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    58

    Re: =SUMPRODUCT help with 3 criteria's

    double post
    Last edited by liqt; 01-30-2017 at 07:44 AM.

  9. #9
    Registered User
    Join Date
    11-07-2012
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    58

    Re: =SUMPRODUCT help with 3 criteria's

    Quote Originally Posted by Pete_UK View Post
    Why can't you just attach a sample Excel workbook, as I described in Post #2, and then we can see what cells and ranges you are using.

    Pete
    okay thanks for your patience

    I have added an work sample

    I appreciate all the help.

    simply the word January or either by month if dd/mm/yy. I don't know if that's possible but according to pete, it seems if the date is submitted by date on 1st sheet, it should still be ok as long as it can filter the month only on the 2nd sheet?
    Attached Files Attached Files
    Last edited by liqt; 01-30-2017 at 07:49 AM.

  10. #10
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: =SUMPRODUCT help with 3 criteria's

    C6
    Please Login or Register  to view this content.
    Try this and copy across
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  11. #11
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,725

    Re: =SUMPRODUCT help with 3 criteria's

    You can put this formula in C6 of Sheet2:

    =SUMPRODUCT(('1'!$C$2:$C$200=$B6)*('1'!$D$2:$D$200=C$4)*(TEXT('1'!$A$2:$A$200,"mmmm")=$D$3))

    Copy it across into D6 to get this formula:

    =SUMPRODUCT(('1'!$C$2:$C$200=$B6)*('1'!$D$2:$D$200=D$4)*(TEXT('1'!$A$2:$A$200,"mmmm")=$D$3))

    then copy both formulae down. Note that you do not need to commit these formulae with Ctrl-Shift-Enter.

    Then you might like to change one or more of the dates in column A of Sheet1 to see the effect.

    Hope this helps.

    Pete

  12. #12
    Registered User
    Join Date
    11-07-2012
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    58

    Re: =SUMPRODUCT help with 3 criteria's

    Quote Originally Posted by Pete_UK View Post
    You can put this formula in C6 of Sheet2:

    =SUMPRODUCT(('1'!$C$2:$C$200=$B6)*('1'!$D$2:$D$200=C$4)*(TEXT('1'!$A$2:$A$200,"mmmm")=$D$3))

    Copy it across into D6 to get this formula:

    =SUMPRODUCT(('1'!$C$2:$C$200=$B6)*('1'!$D$2:$D$200=D$4)*(TEXT('1'!$A$2:$A$200,"mmmm")=$D$3))

    then copy both formulae down. Note that you do not need to commit these formulae with Ctrl-Shift-Enter.

    Then you might like to change one or more of the dates in column A of Sheet1 to see the effect.

    Hope this helps.

    Pete
    This is perfect, I only need to change D$3 to whatever D$" " if I decide to make a new table on sheet 2 which is great.

    The only thing I would like to know is, on sheet 1, if I format the date to show DD/MM/YY. Does the word "January" need to be changed on Sheet 2?

    because right now, I displayed "mmmm" on sheet 1. or will it only take data for that specific month?

    EDIT; OH, IT SEEMS IF I CHANGE THE NAME OF THE MONTH ON SHEET 2, IT AFFECTS THE TABLE RESULTS. INTERESTING. THIS IS MORE THAN WHAT I WANTED.

    I guess I can play around with this then which is able to check data from sheet 1 specifically.

    thanks for the help again, appreciate all the patience and responses
    Last edited by liqt; 01-30-2017 at 08:09 AM.

  13. #13
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,725

    Re: =SUMPRODUCT help with 3 criteria's

    If that takes care of your original question, please take a moment to select Thread Tools from the menu above and to the right of your first post and mark this thread as SOLVED.

    Also, you might like to know that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of a post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).

    Pete

  14. #14
    Registered User
    Join Date
    11-07-2012
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    58

    Re: =SUMPRODUCT help with 3 criteria's

    one last question. for some reason.

    when I try to add another criteria, which I think is right but somewhere, I think the problem is the cell but I cant seem to figure it out



    it should show 4 of each as A and B have problems of door missing and wrong colour

    =SUMPRODUCT(('1'!$C$2:$C$202=$B6)*('1'!$D$2:$D$202=C$4)*('1'!$E$2:$E$202=M$5)*(TEXT('1'!$A$2:$A$202,"mmmm")=$D$3))

    What am I doing wrong here?

    edit; are my pictures not showing?
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by liqt; 01-30-2017 at 10:24 AM.

  15. #15
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,725

    Re: =SUMPRODUCT help with 3 criteria's

    The first condition is checking for the building in B6 (i.e. A), but when the formula is copied down it then checks for the building in B7 (i.e. B). In the second condition it is still looking for a Red door, and there is only 1 red door which is missing in building A. (I'm not sure how a door can be red AND be missing !).

    If you want to show 4 missing doors and 4 doors of the wrong colour, then the building term and the colour term should be omitted, so you would have this in N5:

    =SUMPRODUCT(('1'!$E$2:$E$202=M$5)*(TEXT('1'!$A$2:$A$202,"mmmm")=$D$3))

    Hope this helps.

    Pete

  16. #16
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: =SUMPRODUCT help with 3 criteria's

    not if you are still insisting that the building is A and the door is red!

+ 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: 3
    Last Post: 04-21-2015, 07:45 AM
  2. [SOLVED] Multiple criteria SUMPRODUCT (3 criteria) Excel 2003
    By lelrich in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-10-2014, 01:58 PM
  3. Replies: 6
    Last Post: 08-04-2013, 11:53 AM
  4. SUMPRODUCT - 3 criteria - OR?
    By durktj in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-01-2012, 05:25 AM
  5. [SOLVED] Sumproduct for 3 criteria
    By pjlau in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-03-2012, 09:18 PM
  6. Replies: 5
    Last Post: 04-20-2012, 08:54 AM
  7. Replies: 2
    Last Post: 05-25-2010, 06:55 PM

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