+ Reply to Thread
Results 1 to 11 of 11

Criteria values in COUNTIFS function

  1. #1
    Registered User
    Join Date
    11-20-2008
    Location
    Australia
    Posts
    9

    Criteria values in COUNTIFS function

    I have the following formula in a sheet to record basketball stats that I am putting together.

    =COUNTIFS('Running Game Log'!A:A,"=Jarod",'Running Game Log'!C:C,"=2 pt miss")

    This formula counts from a list that is generated during in-game recording of stats & obviously counts the number of times "Jarod" misses a "2 pt shot".

    My question is can the criteria "Jarod" refer to a value in a cell, rather than the specific name "Jarod" as I want to be able to change player names easily, rather than have to edit this formula every time. I have not been able to find this syntax in any of the Excel help files & I am starting to think it cannot be done...

    TIA

    James
    Last edited by jsnoz; 12-03-2008 at 01:11 AM.

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372
    Hi

    your function won't work like this because countif only takes two arguments.

    You can count how often Jarod appears like this

    =COUNTIF(A5:A13,A3)

    instead of

    =COUNTIF(A5:A13,"Jarod")

    if you type the name in cell A3 for my example.'

    If you want to count with multiple conditions, you need to use Sumproduct. A good description of this is here

    http://www.xldynamic.com/source/xld.SUMPRODUCT.html

    cheers

  3. #3
    Valued Forum Contributor ratcat's Avatar
    Join Date
    03-07-2008
    Location
    Rural NSW, Australia
    MS-Off Ver
    Vista 2007
    Posts
    1,111
    G'day James,

    Your using excel 2007 ??

    If you are try this and double check the spelling and the spacing between the formula and what in the cells.

    Please Login or Register  to view this content.
    Cheers
    Have I made you happy ??? If yes, please make me happy by pressing the http://www.excelforum.com/images/buttons/reputation-40b.png Add Reputation button in my post.
    Please don't forget to do the same to other contributors of this forum.

    Thanks
    I don't void confusion, I create it

  4. #4
    Registered User
    Join Date
    11-20-2008
    Location
    Australia
    Posts
    9
    Teylyn, I am using the COUNTIFS function, not COUNTIF, so I can use multiple arguements, it is just not quite "playing" the way I want it to... The SUMPRODUCT function may work & I will have a go with that too - thanks

    Ratcat - yes I am using 2007 & the formula as I cut it in works just fine, I was just hoping the "Jarod" criteria could refer to a cell rather than a fixed criteria as it makes editiing for use with other teams easier.

    As it appears that COUNTIFS is new to 2007, then I'm equally stuffed as the machine I would be running this on does not have 2007 installed yet...

  5. #5
    Registered User
    Join Date
    12-03-2008
    Location
    Miami
    Posts
    4
    Hi Jsnoz,
    Instead of having the name of the payer in your formula, in this case "Jarod", you can have a separate cell where you enter the name of the player and that way every time you want to use other names, you just type the name in. Your formula should refer to that cell.
    You will have no problem by doing so when using the countifs function.

  6. #6
    Registered User
    Join Date
    11-20-2008
    Location
    Australia
    Posts
    9
    Sumproduct works perfectly

    Please Login or Register  to view this content.
    thanks Terlyn

  7. #7
    Registered User
    Join Date
    11-20-2008
    Location
    Australia
    Posts
    9
    gonzalodb - what you are suggesting is exactly what I tried, but the formula gave me an error when I put a cell reference in there as a criteria, so I was njot sure if it was me, or if it would not be accepted. The SUMPRODUCT solution produces the same resul anyway...

    Cheers

  8. #8
    Valued Forum Contributor ratcat's Avatar
    Join Date
    03-07-2008
    Location
    Rural NSW, Australia
    MS-Off Ver
    Vista 2007
    Posts
    1,111
    G'day jsnoz,

    Your welcome to supply an example of the Countifs formula to see what is going wrong with the cell reference in the formula.

    Cheers

  9. #9
    Registered User
    Join Date
    10-21-2011
    Location
    Toronto, Canada
    MS-Off Ver
    2010
    Posts
    8

    Unhappy Re: Criteria values in COUNTIFS function

    Quote Originally Posted by ratcat View Post
    G'day jsnoz,

    Your welcome to supply an example of the Countifs formula to see what is going wrong with the cell reference in the formula.

    Cheers

    Hi I am having a similar issue with Countifs

    My criterion looks like this

    =COUNTIFS('[april 1, 2011 rent roll.xls]Rent Roll'!$F$20:$F$1222,A4,'[april 1, 2011 rent roll.xls]Rent Roll'!$H$19:$H$1222,">0")

    Where A4 is a cell with text that I want to be found in the f range.

    Both of these ranges and criteria work perfectly if I use the countif formula for just one of them.

    Any help would be greatly appreciated.

    Thanks,

    Gabe

  10. #10
    Registered User
    Join Date
    10-21-2011
    Location
    Toronto, Canada
    MS-Off Ver
    2010
    Posts
    8

    Re: Criteria values in COUNTIFS function

    Just solved my own problem. The ranges have to have the exact same row ranges or there will be an error.

    In my example I was using 20 - 1222 and then 19 - 1222. When I changed it to 20 and 20 it worked fine.

    Thanks anyway

    Gabe

  11. #11
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Criteria values in COUNTIFS function

    Gabe, for future reference.....

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.
    Where there is a will there are many ways.

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

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

+ 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