+ Reply to Thread
Results 1 to 9 of 9

counting instances

  1. #1
    Registered User
    Join Date
    02-22-2013
    Location
    brisbane, australia
    MS-Off Ver
    Excel 2013
    Posts
    91

    counting instances

    Hi, I have attached a spreadsheet with sample data. In column A I have a list of players, in column B I have what game they have played in. I did a formula to try and identify if the player was in game 1 and game 3.
    The formula is =COUNTIFS($A$2:A2,A2,$B$2:B2,"game 1")+COUNTIFS($A$2:A2,A2,$B$2:B2,"game 3"). The formula half works as it does identify the player against game 3 with the result of 2. I would like to see the result of "yes" or something similar so I can filter on the final results to bring up game 1 and game 3 for the player.
    Attached Files Attached Files

  2. #2
    Forum Expert boopathiraja's Avatar
    Join Date
    07-12-2013
    Location
    Coimbatore,TamilNadu, India
    MS-Off Ver
    Excel 2007, 2013, 2016, 365
    Posts
    1,455

    Re: counting instances

    IF(COUNTIFS($A$2:$A$11,A2,$B$2:$B$11,"game 1")+COUNTIFS($A$2:$A$11,A2,$B$2:$B$11,"game 3")>1,"Yes","")
    Click just below left if it helps, Boo?ath?

  3. #3
    Registered User
    Join Date
    02-22-2013
    Location
    brisbane, australia
    MS-Off Ver
    Excel 2013
    Posts
    91

    Re: counting instances

    Thanks Boopathiraha, that is what I want however it shows game 2 as well with "yes", which I was trying to avoid. I only want to see game 1 and game 3. Is there a way to avoid this?

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: counting instances

    Maybe there is a better way but try this one

    =IF(SUM(COUNTIFS($A$2:$A$11,A2,B$2:B$11,{"game 1","game 3"}))-IF(B2="game 2",1,0)>1,"Yes","")
    Last edited by AlKey; 08-02-2014 at 11:10 AM.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Forum Expert boopathiraja's Avatar
    Join Date
    07-12-2013
    Location
    Coimbatore,TamilNadu, India
    MS-Off Ver
    Excel 2007, 2013, 2016, 365
    Posts
    1,455

    Re: counting instances

    May be try this

    IF(OR(B2="game 1",B2="game 3"),IF(AND(COUNTIFS($A$1:$A$11,A2,$B$1:$B$11,"game 1")>=1,(COUNTIFS($A$1:$A$11,A2,$B$1:$B$11,"game 3")>=1)),"Yes",""),"")

  6. #6
    Registered User
    Join Date
    02-22-2013
    Location
    brisbane, australia
    MS-Off Ver
    Excel 2013
    Posts
    91

    Re: counting instances

    Thank you both, Alkey and Boopathiraha. Two good formulas that I can use...I can finally go to sleep now... Thanks again...

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: counting instances

    bit of a typo there alkey
    =IF(SUM(COUNTIFS($A$2:$A$11,A2,$B$2:B$2:B$11,{"game 1","game 3"}))-IF(B2="game 2",1,0)>1,"Yes","")
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  8. #8
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: counting instances

    Perhaps this will satisfy the problem. Nothing is indicated unless Game 1 and Game 3 have been played. Game 1 has been left blank because as of that time, Game 3 has not been played. Therefore, the result is beside Game 3 if the conditions have been satisfied.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  9. #9
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: counting instances

    Quote Originally Posted by martindwilson View Post
    bit of a typo there alkey
    =IF(SUM(COUNTIFS($A$2:$A$11,A2,$B$2:B$2:B$11,{"game 1","game 3"}))-IF(B2="game 2",1,0)>1,"Yes","")
    Thanks Martin. It is now corrected Good thing it did not effected calculations.

+ 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. Counting Instances of Sick
    By boblardo in forum Excel General
    Replies: 6
    Last Post: 03-12-2012, 08:55 AM
  2. Counting instances in a filter
    By alimjiv in forum Excel General
    Replies: 4
    Last Post: 11-11-2011, 02:43 PM
  3. Counting the number of instances
    By jswarb001 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-09-2007, 08:24 AM
  4. Counting instances of an offset value???
    By Simon Lloyd in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-12-2005, 04:37 AM
  5. counting instances of decimals
    By Eden in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-21-2005, 11:23 AM

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