+ Reply to Thread
Results 1 to 13 of 13

Count based on multiple criteria

  1. #1
    Registered User
    Join Date
    10-11-2014
    Location
    California
    MS-Off Ver
    Office 2010
    Posts
    7

    Count based on multiple criteria

    Hello everybody. I'm Steve, I'm new here. I thought this would be a good place to get some advice, so here I am.

    I'm currently working on a pet project of mine and could definitely use some help with the formulas. I'm not a programmer, not a technician of any kind, so I really am flying by the seat of my pants and "programming" via what I learn off the internet. I'm actually a lifeguard who all things nerdy.

    One problem I'm running in to now is with the pet project of mine. I'm working on an NHL Results chart for my favorite team, the Los Angeles Kings. I've attached what I'm working on so far. If you could focus on columns F, G, and H, that'd be wonderful (Please ignore all the colors and so forth, they're just markers for me).

    In hockey, a team can either win (in regulation or overtime), win after a shootout (what we call a SOW), lose (in regulation), lose in overtime, (OTL), or lose after a shootout (a SOL). Wins (regulation or SOW) are 2 points in the standings. A loss in regulation is 0 points. A OTL or SOL is 1 point.

    I'm having difficulty getting column H "record" to recognize the differences between a loss, and a shootout loss. So far I've been trying the formula =CONCATENATE(COUNTIF($G$2:$G$2,"Win"),"-",COUNTIF($G$2:$G$2,"Loss"),"-",COUNTIF($F$2:$G$2, AND(F="Yes",G="Loss")))

    It works great for wins and losses, yet, that does not seem to account for SOL.

    I've tried to make the formula look for whether the game was a win or loss, and then if a loss, determining whether it was a shootout or not (hence the need for columns F and G labeled Shootout? and Result).

    It would be amazing if there was someone who could devise a formula that would produce a record in the format I like (wins-losses-SOLs) by referencing columns F and G. I am certainly in over my head and can't seem to get it.

    Similarly, I would love a formula for cell O3 that can sum all wins minus shootout wins when LA is only the home team (I have wins and losses figured out for when LA is home or away). Ditto cell X3 when LA is away

    Any and all help is greatly appreciated.
    Attached Files Attached Files
    Last edited by FDibbins; 10-11-2014 at 05:53 PM.

  2. #2
    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,938

    Re: Count based on multiple criteria

    Hi, welcome to the forum

    For future reference, please title your threads with something that describes your problem - I have changed it for you - this time

    Not sure of this is what you want, give it a shot...
    =COUNTIF($G$2:G2,"Win")&"-"&COUNTIF($G$2:G2,"Loss")&"-"&SUM(COUNTIF($F$2:G2,{"Yes","Loss"}))
    copied down
    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

  3. #3
    Registered User
    Join Date
    10-11-2014
    Location
    California
    MS-Off Ver
    Office 2010
    Posts
    7

    Re: Count based on multiple criteria

    I'm sorry, that doesn't seem to work. When I plug that in to cell H2, it displays as 0-1-1, when it should read 0-1-0.

    It's the same problem I've been having for a couple days now. In an ideal world, it would work like an "if-then" statement. As in, if the loss is due to a shootout, then it's a SOL (Condition 3). If the loss is not a shootout loss, then it's just a normal loss (Condition 2)

    Ugh, so frustrating!

  4. #4
    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,938

    Re: Count based on multiple criteria

    I'm sorry, that doesn't seem to work. When I plug that in to cell H2, it displays as 0-1-1, when it should read 0-1-0.
    F2=No, but G2=Loss, so I would have thought that last number would be 1?

  5. #5
    Registered User
    Join Date
    10-11-2014
    Location
    California
    MS-Off Ver
    Office 2010
    Posts
    7

    Re: Count based on multiple criteria

    Quote Originally Posted by FDibbins View Post
    F2=No, but G2=Loss, so I would have thought that last number would be 1?
    That's exactly what I have in F2 and G2, and yet H2 still reads 0-1-1

  6. #6
    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,938

    Re: Count based on multiple criteria

    Ok then Im not following you lets assume that the 1st 2 numbers are cottect, and we can then just focus on the 3rd number.

    My understanding was that you wanted a count of when F = Yes and when G = Loss. Well it looks to me like you have F2=NO and G2=Loss, so to me, that would return a 1?

    That last part of the formula does just that...
    SUM(COUNTIF($F$2:G2,{"Yes","Loss"}))

    What am I missing here?

  7. #7
    Registered User
    Join Date
    10-11-2014
    Location
    California
    MS-Off Ver
    Office 2010
    Posts
    7

    Re: Count based on multiple criteria

    Whatever you're missing, I'm missing too. I have exactly as you've described; F=No and G=Loss should produce a zero in the third variable (0-1-0). Instead, it produces a 1 (0-1-1)

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

    Re: Count based on multiple criteria

    OK so we are both looking at the same thing.

    Are you counting Yes or No?
    Are you counting Win or Loss?

    in other words, does Yes = 1 or does No = 1, and dows Win = 1 or does Loss = 1

  9. #9
    Registered User
    Join Date
    10-11-2014
    Location
    California
    MS-Off Ver
    Office 2010
    Posts
    7

    Re: Count based on multiple criteria

    Honestly, you lost me there. I don't know what that means.

    The only time we should get a value in the third condition is when there is both yes and loss. It seems the formula is counting anytime "loss" occurs as a value, regardless of whether there is a "yes" or "no" as well, when I need it to count only the combination of "loss" and "yes".

    Additional question, in your formula, why have you used braces instead of brackets towards the end of the formula?
    Last edited by yggdrasil52; 10-13-2014 at 12:33 AM.

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

    Re: Count based on multiple criteria

    OK I think your last post cleared it up for me (I hope lol)...
    =COUNTIF($G$2:G2,"Win")&"-"&COUNTIF($G$2:G2,"Loss")&"-"&COUNTIFS($F$2:F2,"Yes",$G$2:G2,"Loss")

  11. #11
    Registered User
    Join Date
    10-11-2014
    Location
    California
    MS-Off Ver
    Office 2010
    Posts
    7

    Re: Count based on multiple criteria

    Holy moly you've done it!

  12. #12
    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,938

    Re: Count based on multiple criteria

    lol sorry it took so long, I didnt get that F had to be Yes AND G had to be Loss.

    Im just glad we got you where you wanted to be - and thanks for the feedback

  13. #13
    Registered User
    Join Date
    10-11-2014
    Location
    California
    MS-Off Ver
    Office 2010
    Posts
    7

    Re: Count based on multiple criteria

    What if, instead of displaying a count (a number), I wanted the cell to display text? I.e. Display "win" if certain criteria are met.

+ 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. Replies: 5
    Last Post: 08-06-2014, 01:10 PM
  2. Replies: 1
    Last Post: 05-02-2014, 03:05 PM
  3. [SOLVED] Function that concatenates multiple sub-project descriptions based on project code
    By markbpi in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-28-2012, 06:49 PM
  4. [SOLVED] Insert Blank Rows between sorted projects, Subtotal project to the right of final project.
    By ZAC7 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-07-2012, 04:08 AM
  5. Replies: 1
    Last Post: 10-18-2005, 11:05 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