+ Reply to Thread
Results 1 to 10 of 10

Using COUNTA and COUNTIFS in the same formula

  1. #1
    Registered User
    Join Date
    12-13-2012
    Location
    Portland, OR
    MS-Off Ver
    Excel 2010
    Posts
    5

    Using COUNTA and COUNTIFS in the same formula

    Newish to Excel, and stuck.

    I'm trying to figure out how many instances occurred of a student getting a grade on a test. Each time the student takes a test, it is entered as a new row. Each test has two parts, and sometimes students take one part but not the other. I need to figure out a formula to tell me how many tests each student has taken within a given fiscal year.

    My column A is fiscal year. Column B is the list of names. Column E is part A of the test, and Column F is part B of the test. My self-trained instincts tell me that the formula should look something like:

    =COUNTA(COUNTIFS(A:A,"2013",B:B, I9)), (E:E)

    Where I'm looking for FY 2013, and the student's name is in cell I9 in this example.

    However, Excel doesn't like that formula. Any thoughts? Thank you in advance for your assistance.

  2. #2
    Forum Contributor dogberry's Avatar
    Join Date
    07-15-2012
    Location
    Wales, UK
    MS-Off Ver
    Excel 2010
    Posts
    624

    Re: Using COUNTA and COUNTIFS in the same formula

    Hi

    Can you post a sample worksheet so we can see the layout etc dont post confidentail information


    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.



    Chris
    Click my star if I helped Thanks

  3. #3
    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,939

    Re: Using COUNTA and COUNTIFS in the same formula

    as suggested, upload a sample file. but this may work for you...

    =COUNTIFS(A:A,"2013",B:B, I9,E:E,"A",F:F,"B")

    this assumes that your year data is just those 4 numbers, and not an actual date (12/14/2012), and also that "A" = that part A was taken, "B" = that part B was taken
    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

  4. #4
    Registered User
    Join Date
    12-13-2012
    Location
    Portland, OR
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Using COUNTA and COUNTIFS in the same formula

    Here is the attached spreadsheet, edited for confidentiality.
    Attached Files Attached Files

  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,939

    Re: Using COUNTA and COUNTIFS in the same formula

    try this, copied down and across

    =COUNTIFS($A$2:$A$78,2013,$B$2:$B$78,$I9,$E2:$E78,"<>"&"")

  6. #6
    Registered User
    Join Date
    12-13-2012
    Location
    Portland, OR
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Using COUNTA and COUNTIFS in the same formula

    That works, thank you so much. I replaced the $A$2:$A$78 et. al. with $A:$A as this list continually grows as more students test. Do you anticipate this being an issue?

  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,939

    Re: Using COUNTA and COUNTIFS in the same formula

    im happy we helped.

    i would just point out that you should try and restrict reference ranges if you can (i go 2-3 times more than what i think i will need). using entire rows or columns can become very resource-intensive, if there are many of them

  8. #8
    Registered User
    Join Date
    12-13-2012
    Location
    Portland, OR
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Using COUNTA and COUNTIFS in the same formula

    Excellent, thank you so much. I truly appreciate your time.

  9. #9
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Using COUNTA and COUNTIFS in the same formula

    Normally with the "IFS" functions such as SUMIF/SUMIFS, COUNTIF/COUNTIFS it's not an issue to use the whole column - Excel actually restricts the calculations to the "used range" so the efficiency shouldn't be compromised.

    That's different with "array formulas" and SUMPRODUCT, though. There I would avoid full columns.

    Note you can just use "<>" as the last criterion like

    =COUNTIFS(A:A,2013,B:B,$I9,E:E,"<>")
    Audere est facere

  10. #10
    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,939

    Re: Using COUNTA and COUNTIFS in the same formula

    thanks for the tips DDL

+ 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.6.0 RC 1