+ Reply to Thread
Results 1 to 15 of 15

Ideas on how to perform a count based on multiple criteria

  1. #1
    Registered User
    Join Date
    07-13-2014
    Location
    London
    MS-Off Ver
    2007
    Posts
    5

    Ideas on how to perform a count based on multiple criteria

    Hi, hopefully an Excel genius can help
    Ok, I have an exams spreadsheet, with students names in Column A (lines 1-100), and then Gender (M/F) in column B, followed by Subjects in Columns C/D/E/F/G.
    I know how to count the total subject "A" Passes (Countif), and the total number of "A" Passes by Gender (Countifs) but what I'm really looking to do is count the number of students who have achieved either a grade A,B or C across 3 or more subjects.
    Any ideas ?
    Thanks !

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,462

    Re: Ideas on how to perform a count based on multiple criteria

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

  3. #3
    Registered User
    Join Date
    07-13-2014
    Location
    London
    MS-Off Ver
    2007
    Posts
    5

    Re: Ideas on how to perform a count based on multiple criteria

    Thanks
    Ok if you refer to the attached, in Column K I'm looking for a formulae that will return a value of 1 if the student has achieved 3 or more Grade A* - C (the A* over here is a grade above an A).
    I've highlighted in green the results of 3 or more A* - C.
    Thanks in advance for any suggestions.
    Attached Files Attached Files

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Ideas on how to perform a count based on multiple criteria

    Maybe this...

    Data Range
    C
    D
    E
    F
    G
    1
    Subject1
    Subject2
    Subject3
    Subject4
    Subject5
    2
    D
    D
    B
    C
    F
    3
    A
    A
    A
    A
    A
    4
    C
    D
    D
    C
    B
    5
    F
    F
    C
    C
    D
    6
    C
    D
    D
    C
    C


    =SUMPRODUCT(--(MMULT(--ISNUMBER(MATCH(C2:G6,{"A","B","C"},0)),{1;1;1;1;1})>=3))

    Result = 3

    Rows 3, 4 and 6 are being counted.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    07-13-2014
    Location
    London
    MS-Off Ver
    2007
    Posts
    5

    Re: Ideas on how to perform a count based on multiple criteria

    That is a genius answer, and it works, thanks so much !!
    One more question, is there a function menu option that will step me through the above, or an abbreviated version ? Reason I ask is that this may crop up in my exam, and I would be hard pushed to remember this formulae.
    Thanks

  6. #6
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Ideas on how to perform a count based on multiple criteria

    Edit: I think I misunderstood the question. Probably you need the total count not the count for each row.
    Last edited by sktneer; 07-13-2014 at 03:36 PM.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Ideas on how to perform a count based on multiple criteria

    Try this...

    Select the formula cell.

    Goto the Formulas tab.

    In the Formula Auditing group, click on the Evaluate Formula icon. It's the one that looks just like my avatar!

    That will open a userform. Repeatedly click the Evaluate button and it will step through the formula showing you the results of each step.

  8. #8
    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,957

    Re: Ideas on how to perform a count based on multiple criteria

    Withe cursor on that cell, click the Fx (insert function) button to the left of the formula bar. a window will open, and you can step through the formula to see what is doing what
    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

  9. #9
    Registered User
    Join Date
    07-13-2014
    Location
    London
    MS-Off Ver
    2007
    Posts
    5

    Re: Ideas on how to perform a count based on multiple criteria

    Thanks Pepe, Tony, Sktneer and FDibbins, between you guys you have solved my issue and I will sleep easy tonight
    This forum is excellent and is now saved in my bookmarks !

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Ideas on how to perform a count based on multiple criteria

    You're welcome. We appreciate the feedback!

    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

  11. #11
    Registered User
    Join Date
    07-13-2014
    Location
    London
    MS-Off Ver
    2007
    Posts
    5

    Re: Ideas on how to perform a count based on multiple criteria

    Ok done, thanks Tony

  12. #12
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Ideas on how to perform a count based on multiple criteria

    @ Tony

    While trying to understand your formula using MMULT function (which I never used), one issue I was thinking about that what if the data set is large say 25 columns or more, what is the best way to define the array2 inside the mmult. Though you have used {1;1;1;1;1}, will it be ok to use another formula to define the this array part?

    Please refer to the sheet attached in OP's post#3, can I use the formula like below, though it becomes an Array Formula then...

    Please Login or Register  to view this content.
    Or is there an better way to define the array2 inside the mmult function?

    Your assistance is needed.

  13. #13
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Ideas on how to perform a count based on multiple criteria

    In this application the 2nd array needs to be a vertical array of 1s, one for each column in the range.

    When there are only a "few" columns in the range we can use an array constant as I have:

    {1;1;1;1;1}

    When there are "many" columns you wouldn't necessarily want to use an array constant like this:

    {1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1}

    So, we need generate that array via calculation. Any method you can think of will work but I would tend to use:

    COLUMN(Range)^0

    Since we now have to use the TRANSPOSE function which requires array entry** I would replace SUMPRODUCT with SUM:

    =SUM(--(MMULT(--(ISNUMBER(MATCH(E3:I12,{"A*","A","B","C"},0))),TRANSPOSE(COLUMN(E3:I12)^0))>=3))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

  14. #14
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Ideas on how to perform a count based on multiple criteria

    @ Tony

    COLUMN(Range)^0 is a great idea to generate array of 1's.
    Thanks a lot Tony for the guidance you have provided.

  15. #15
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Ideas on how to perform a count based on multiple criteria

    You're welcome!

+ 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. Help needed to perform COUNT based on multiple criteria
    By mattzz11 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 06-26-2012, 03:25 PM
  2. [SOLVED] Need Count based on Multiple Criteria
    By sureshpillitla in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-12-2012, 02:47 AM
  3. Count based on multiple criteria
    By efernandes67 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-15-2011, 02:57 PM
  4. Linking multiple IF statements to perform different Function Based on criteria
    By Kimberly@TM in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-26-2010, 02:44 PM
  5. Count Multiple Entries, Return Multiple Rows, Based On 3 Criteria
    By gtj_global in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-20-2008, 06:40 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