+ Reply to Thread
Results 1 to 18 of 18

head swimming with countif

  1. #1
    Registered User
    Join Date
    05-10-2015
    Location
    Ryton
    MS-Off Ver
    Office 2013
    Posts
    49

    head swimming with countif

    Hi All

    I am trying to use the count if function to start a process that will return the number of "wins" a name has in a table

    I can then return this number as a percentage of the total entries for that name

    I have fallen at the first as I cannot get countif to do as I want

    Can anyone enlighten me on this Problem please
    Moose
    Attached Files Attached Files

  2. #2
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: head swimming with countif

    Try
    G2=COUNTIFS(Table2[Name],F2)/COUNTA(Table2[Win/Place/lose])*100

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  3. #3
    Registered User
    Join Date
    05-10-2015
    Location
    Ryton
    MS-Off Ver
    Office 2013
    Posts
    49

    Re: head swimming with countif

    Hi Ankur
    Thanks for the quick response

    In the example Joe wins 4 times out of ten tries This is a strike rate percentage of 40%

    Your solution returns 21%

    Do I have to specify "win" in the formula you gave

    Moose

  4. #4
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: head swimming with countif

    Try
    =COUNTIFS(Table2[Win/Place/lose],"win ",Table2[Name],F2)/COUNTIF(Table2[Name],F2)*100

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Note:- You have trailing space in B column for Win that is why i used the same criteria for that as "win ".
    Last edited by shukla.ankur281190; 10-17-2015 at 03:37 AM.

  5. #5
    Registered User
    Join Date
    05-10-2015
    Location
    Ryton
    MS-Off Ver
    Office 2013
    Posts
    49

    Re: head swimming with countif

    Hi
    That works great - I think
    have added Tom and harry to table 2 and tom gets 100% for 1 win out of 1 - superb

    Then I copied the formula to the next cell right to get the strike rate for places changed the name cell to "place" the reference cells back to F2 as they changed to G2
    but I am getting Div/0 error and cannot see any reason why

    any suggestions
    moose
    Attached Files Attached Files

  6. #6
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: head swimming with countif

    May be you have posted wrong file. Better if you can post the same working file with desired result. :

  7. #7
    Registered User
    Join Date
    05-10-2015
    Location
    Ryton
    MS-Off Ver
    Office 2013
    Posts
    49

    Re: head swimming with countif

    Oops what a dummy

    saved the file on my machine forgot to upload it sorry
    Attached Files Attached Files

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: head swimming with countif

    It's because Harry has had no wins. What do you want to appear when that is the case?

    To simply show a blank cell if there have been no wins, edit the formula thus:
    Please Login or Register  to view this content.
    Last edited by AliGW; 10-17-2015 at 03:22 AM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  9. #9
    Registered User
    Join Date
    05-10-2015
    Location
    Ryton
    MS-Off Ver
    Office 2013
    Posts
    49

    Re: head swimming with countif

    Good point in answer to that question - an unhappy face ??? is that possible ?

    but seriously the formula in cell H2 is not returning the percentage of places

  10. #10
    Registered User
    Join Date
    05-10-2015
    Location
    Ryton
    MS-Off Ver
    Office 2013
    Posts
    49

    Re: head swimming with countif

    Good point in answer to that question - an unhappy face ??? is that possible ?

    but seriously the formula in cell H2 is not returning the percentage of places

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: head swimming with countif

    That's because you have "Place " instead of "Place" in the formula (can you see the space after the 'e'?).

    Sad face formula:

    Please Login or Register  to view this content.
    Last edited by AliGW; 10-17-2015 at 03:34 AM.

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: head swimming with countif

    Actually, all of your Win entries in the table have a trailing space, but the Place entries don't.

  13. #13
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: head swimming with countif

    Let forget everything Try

    G2=IFERROR(SUMPRODUCT((TRIM(Table2[Name])=TRIM($F2))*(TRIM(Table2[Win/Place/lose])="Win"))/SUMPRODUCT((TRIM(Table2[Name])=TRIM($F2))*1)*100,"")

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    It will work if there will trailing space.
    Last edited by shukla.ankur281190; 10-17-2015 at 03:38 AM.

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: head swimming with countif

    Let forget everything
    Fine, but let's explain what we are doing and why!!!

    @MadMoose: shukla.ankur281190's formula deals with the trailing spaces I mentioned, and gets rid of them if they are there before doing the calculation.

  15. #15
    Registered User
    Join Date
    05-10-2015
    Location
    Ryton
    MS-Off Ver
    Office 2013
    Posts
    49

    Re: head swimming with countif

    That would explain A great deal

    Thank you for you help

    I have got it going now and harry was a typing mismatch which returned the error result
    if a name had no wins is it possible to put the smiley unhappy in
    I can see the the previous function is for an error and thank you for that but what if it was a zero - this is just the devil in me
    moose

  16. #16
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: head swimming with countif

    For 0, you'll need to add another IF statement. I'm afraid i have to go out now, but i am sure that someone else will show you how. As for the smiley: I'm really not sure, but I doubt it. You could use conditional formatting with one of the icons available, though.

  17. #17
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: head swimming with countif

    ...at the risk of sowing further confusion and in order to account for trailing spaces should they be there or not then from AliGW's post #8 use the wildcard character. i.e.

    =IFERROR(COUNTIFS(Table2[Win/Place/lose],"win*",Table2[Name],F2)/COUNTIF(Table2[Name],F2)*100,"")

    And use CF for the non smiley as suggested.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  18. #18
    Registered User
    Join Date
    05-10-2015
    Location
    Ryton
    MS-Off Ver
    Office 2013
    Posts
    49

    Re: head swimming with countif

    Thankyou one and all

    I have now successfully incorporated this into my main work book and it works fine

    just a note for anyone else with the same prob if you delete the *100 from the end of the function and set the cell to percentage you will get the percent sign in the cell after the figure

    Once again thank you all

+ 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. League Table Based on Head to Head results
    By darkblueblood in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-16-2023, 07:10 AM
  2. [SOLVED] How to insert a previous Head to head matches ?
    By malveiro in forum Excel General
    Replies: 7
    Last Post: 05-14-2015, 08:34 AM
  3. Breaking ties in a head to head contest
    By cklemme in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 01-28-2014, 01:06 AM
  4. How to account for head to head matchup in Excel with other tie breakers
    By Biogeek1 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-26-2013, 05:18 PM
  5. Head to Head (Tiebreakers) in Champions League
    By jovisb1993 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-26-2013, 06:50 PM
  6. Calculate average of last two outcomes of last two head-to-head clashes
    By wishkey in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-07-2013, 08:17 AM
  7. Ranking a league table by head to head results
    By pajc72 in forum Excel General
    Replies: 1
    Last Post: 09-02-2011, 07:02 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