+ Reply to Thread
Results 1 to 12 of 12

SUMPRODUCT or COUNTIF issue

  1. #1
    Registered User
    Join Date
    12-07-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    4

    SUMPRODUCT or COUNTIF issue

    Hello,

    I am wanting to count the number of records which meet 2 bits of criteria.

    To set the scene:
    Counting the number of cars which have certain production Year and Model in a Sheet.

    1:
    Criteria: Must be exact Year (eg. 2012) in cell C6. Range: being named range called "ListYear"

    2:
    Criteria: Must be any model (eg. Focus) from a named range "Models" again in the named range called "ListModel"

    So for 1 successful count the car must be in year "2012" and model being a "Focus"

    Note: Ranges ListYear and ListModel are 2 corresponding columns next to each other in one sheet.

    I have tried :- but doesn't work!

    Please Login or Register  to view this content.
    Thanks for your help in advance.

    Paul

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,944

    Re: SUMPRODUCT or COUNTIF issue

    without seeing what you are working with, try something like this...

    =countifS(range1,criteria1,range2,criteria2)
    so maybe...
    =countifS(ListYear,c6,ListModel,model)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    12-07-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: SUMPRODUCT or COUNTIF issue

    Quote Originally Posted by FDibbins View Post
    without seeing what you are working with, try something like this...

    =countifS(range1,criteria1,range2,criteria2)
    so maybe...
    =countifS(ListYear,c6,ListModel,model)
    Thanks for your reply.

    I have got that working to a specific cell for the "model" criteria but not for a named range.

    So maybe I should reask...

    How do you use a named range as criteria - so that it can match any of the values in the named range!

    Cheers

    Paul

  4. #4
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: SUMPRODUCT or COUNTIF issue

    do the Model list have production years associated with them?
    if there is no way to tell if the model was built in the needed year, how can you match it to any SPECIFIC YEAR request?
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,944

    Re: SUMPRODUCT or COUNTIF issue

    i would suggest you upload a sample work book, (all sensitive data removed), showing what data you are working with, what your expected outcome is, and how you arrived at that

    To Attach a File:

    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.

  6. #6
    Registered User
    Join Date
    12-07-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: SUMPRODUCT or COUNTIF issue

    Attached is a smaller version to what I am doing...

    Thanks again!
    Attached Files Attached Files

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,944

    Re: SUMPRODUCT or COUNTIF issue

    ok try this, copied down...
    =COUNTIFS(TheList!$A$2:$A$7,A4,TheList!$B$2:$B$7,ModelList!$A$2)+COUNTIFS(TheList!$A$2:$A$7,A4,TheList!$B$2:$B$7,ModelList!$A$3)+COUNTIFS(TheList!$A$2:$A$7,A4,TheList!$B$2:$B$7,ModelList!$A$4)

  8. #8
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: SUMPRODUCT or COUNTIF issue

    Maybe with an pivot table?

    See the attached file.
    Attached Files Attached Files
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,944

    Re: SUMPRODUCT or COUNTIF issue

    happy to help and thanks for the rep

  10. #10
    Registered User
    Join Date
    12-07-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: SUMPRODUCT or COUNTIF issue

    Quote Originally Posted by FDibbins View Post
    ok try this, copied down...
    =COUNTIFS(TheList!$A$2:$A$7,A4,TheList!$B$2:$B$7,ModelList!$A$2)+COUNTIFS(TheList!$A$2:$A$7,A4,TheList!$B$2:$B$7,ModelList!$A$3)+COUNTIFS(TheList!$A$2:$A$7,A4,TheList!$B$2:$B$7,ModelList!$A$4)
    Thanks FDibbins,

    Although I want it so that the model list can be expanded easily.

    Is there any way to get a named range in there??

    Thanks for your input though

    Paul

  11. #11
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: SUMPRODUCT or COUNTIF issue

    Yes, that's possible.

    Then you get something like this.

    Please Login or Register  to view this content.
    And a solution with pivot table (see #8)?

  12. #12
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: SUMPRODUCT or COUNTIF issue

    An alternative

    =SUMPRODUCT(--(TheList!$A$2:$A$7=Summary!A4),--(ISNUMBER(MATCH(TheList!$B$2:$B$7,ModelList,0))))
    Last edited by Bob Phillips; 12-08-2012 at 05:45 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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